public function executeEdit() { $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $c = new Criteria(); $c->add(JobPeer::CODE, $this->getModuleName()); $job = JobPeer::doSelectOne($c); $acl = AclPeer::retrieveByPK($group_id, $job->getId()); if (!$acl) { $this->forward('default', 'error404'); } $this->can_add = $acl->getAddPriv() == 1; $this->can_edit = $acl->getEditPriv() == 1; $this->can_remove = $acl->getRemovePriv() == 1; $user_group = UserGroupPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($user_group); if ($user_group->getJobTemplateId() == 11) { $c = new Criteria(); $cton1 = $c->getNewCriterion(JobPeer::ID, 132, Criteria::NOT_IN); $cton2 = $c->getNewCriterion(JobPeer::JOB_TEMPLATE_ID, 1, Criteria::IN); $cton3 = $c->getNewCriterion(JobPeer::JOB_TEMPLATE_ID, 3, Criteria::IN); $cton4 = $c->getNewCriterion(JobPeer::JOB_TEMPLATE_ID, 11, Criteria::IN); $cton3->addOr($cton4); $cton2->addOr($cton3); $cton1->addAnd($cton2); $c->add($cton1); $c->addAscendingOrderByColumn(JobPeer::MENU_ORDER); $jobs = JobPeer::doSelect($c); } else { $c = new Criteria(); $cton1 = $c->getNewCriterion(JobPeer::ID, 132, Criteria::NOT_IN); $cton2 = $c->getNewCriterion(JobPeer::JOB_TEMPLATE_ID, $user_group->getJobTemplateId(), Criteria::IN); $cton3 = $c->getNewCriterion(JobPeer::JOB_TEMPLATE_ID, $user_group->getJobTemplate()->getParent(), Criteria::IN); $cton4 = $c->getNewCriterion(JobPeer::JOB_TEMPLATE_ID, 11, Criteria::IN); $cton3->addOr($cton4); $cton2->addOr($cton3); $cton1->addAnd($cton2); $c->add($cton1); $c->addAscendingOrderByColumn(JobPeer::MENU_ORDER); $jobs = JobPeer::doSelect($c); } foreach ($jobs as $job) { $c = new Criteria(); $c->add(JobPeer::PARENT, $job->getId()); $c->add(JobPeer::DISPLAY_MENU, true); $job->child = JobPeer::doCount($c); $c = new Criteria(); $c->add(AclPeer::USER_GROUP_ID, $user_group->getId(), Criteria::EQUAL); $c->add(AclPeer::JOB_ID, $job->getId(), Criteria::EQUAL); $job->acl = AclPeer::doSelectOne($c); $job->level = $job->getLevel(); $job->order = $job->getMenuOrderRecursive(); } $actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value"))); if ($user_group->getCode() != 'admin' && $user_group->getCode() != 'student' && $user_group->getCode() != 'lector') { array_push($actions, array('name' => 'delete', 'url' => 'user_group/delete?id=' . $user_group->getId(), 'color' => 'red')); } array_push($actions, array('name' => 'cancel', 'url' => 'user_group/list', 'color' => 'white')); $this->subtitle = $user_group->toString() . ' - id:' . $user_group->getId(); $this->type = 'edit'; $this->user_group = $user_group; $this->icon = 'user_edit.png'; $this->actions = $actions; $this->jobs = $jobs; }