I have created a custom plugin to tag a list of usernames in ckeditor. The methodology for implementing is to get the data from the ajax controller. The following is the ajax function to get the list of user names.
$org = new VA_Logic_Organization($orgid);
if ($groupid) {
$group = new VA_Logic_Group($groupid);
if ($group->assigntomanager == 1) {
$manager = new VA_Logic_Avatar($group->managerid);
$avatarlist[$group->managerid] = $manager->firstname . ' ' . $manager->lastname;
} else {
$avatarlist = $group->getAvatarListByName($name, $form->hideleveldifference);
}
} else if ($form->defaultassigngroup) {
$group = new VA_Logic_Group($form->defaultassigngroup);
if ($group->assigntomanager == 1) {
$manager = new VA_Logic_Avatar($group->managerid);
$avatarlist[$group->managerid] = $manager->firstname . ' ' . $manager->lastname;
} else {
$avatarlist = $group->getAvatarListByName($name, $form->hideleveldifference);
}
} else {
$avatarlist = $org->getAvatarListByName($name, $form->hideleveldifference);
}
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(TRUE);
echo json_encode($avatarlist);
The following is the ckedior pluginname.js.
elements: [
{
type: 'select',
id: 'exam_ID',
label: 'Select Exam',
items :function(element)
{
$.ajax({
type: 'POST',
url: baseurl +"employee/ajax/assignedtoselect/groupid/" ,
contentType: 'application/json; charset=utf-8',
dataType: 'json',
async: false,
});
}
}
]
I need to populate the json data on click of the dialog text box.