/** * returns usergroups. * * this method is used by the notification module and new/edit users. * * @param boolean $all if false only user group will be returned. * @return json user groups */ public function getallJsonAction() { $dao = new RM_UserGroups(); $all = $this->_getParam('returnall', false); // param to fetch all groups if ($all) { $groups = $dao->fetchAll(); } else { $groups = $dao->fetchAll("id='0'"); } foreach ($groups as $group) { $jsonFields[] = array("id" => $group->id, "name" => $group->name); } $json = array("data" => Zend_Json::encode($jsonFields), "encoded" => true); return $json; }
public function editJsonAction() { $json = new stdClass(); $id = $this->_getParam('id'); $dao = new RM_Users(); $user = $dao->getToGUI($id); $config = new RM_UserConfig(); $fields = $config->getEditFormByUser($user['group_id']); foreach ($fields as $field) { $jsonFields[] = $field->view_preferences; } // just get the selected UserType $groups = new RM_UserGroups(); $groupinfo = $groups->getAll(); $json = array("data" => "{ users : " . Zend_Json::encode($user->toArray()) . ", fields : [" . implode(',', $jsonFields) . "], groupinfo : " . Zend_Json::encode($groupinfo->toArray()) . "}", "encoded" => true); return $json; }