本文整理汇总了PHP中AclPeer::retrieveByPK方法的典型用法代码示例。如果您正苦于以下问题:PHP AclPeer::retrieveByPK方法的具体用法?PHP AclPeer::retrieveByPK怎么用?PHP AclPeer::retrieveByPK使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AclPeer
的用法示例。
在下文中一共展示了AclPeer::retrieveByPK方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeList
public function executeList()
{
$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;
$c = new Criteria();
$dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo');
$c->add(AcademicCalendarPeer::DEPARTMENT_ID, $dept->getChildRecurs(), Criteria::IN);
$filters = null;
if ($this->getRequest()->hasParameter('filters')) {
$filters = $this->getRequestParameter('filters');
if ($filters == 'clear') {
$this->filters = null;
} else {
$defined_filter = false;
foreach ($filters as $f) {
if (is_array($f)) {
if (strlen($f['from']) > 0 || strlen($f['to']) > 0) {
$defined_filter = true;
break;
}
} else {
if ($f != null && $f != '') {
$defined_filter = true;
break;
}
}
}
if ($defined_filter) {
$this->filters = $filters;
$this->filter($c, $this->getRequestParameter('filters'));
}
}
}
$rpp = $this->getRequestParameter('max_per_page', 999);
$pager = new sfPropelPager('AcademicCalendar', $rpp);
$pager->setPeerMethod('doSelectOrdered');
$pager->setCriteria($c);
$pager->setPage($this->getRequestParameter('page', 1));
$pager->init();
$this->pager = $pager;
$actions = array(array('name' => 'filter', 'color' => 'white'));
$filter_string = "";
if ($filters) {
foreach ($filters as $key => $val) {
$filter_string .= "&filters[{$key}]={$val}";
}
$filter_string = preg_replace('/^&/', '', $filter_string);
}
$this->actions = $actions;
}
示例2: executeList
public function executeList()
{
$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;
$dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo');
$c = new Criteria();
$c->addAscendingOrderByColumn(CourseSchedulePeer::CLASS_GROUP_ID);
$this->sort($c);
if ($this->getRequest()->hasParameter('filters')) {
$filters = $this->getRequestParameter('filters');
if ($filters == 'clear') {
$this->filters = null;
} else {
$defined_filter = false;
foreach ($filters as $f) {
if (is_array($f)) {
if (strlen($f['from']) > 0 || strlen($f['to']) > 0) {
$defined_filter = true;
break;
}
} else {
if ($f != null && $f != '') {
$defined_filter = true;
break;
}
}
}
if ($defined_filter) {
$this->filters = $filters;
$this->filter($c, $this->getRequestParameter('filters'));
}
}
}
$rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'course'));
$this->getUser()->setAttribute('max_per_page', $rpp, 'course');
$pager = new sfPropelPager('CourseSchedule', $rpp);
$pager->setCriteria($c);
$page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'course'));
$this->getUser()->setAttribute('page', $page, 'course');
$pager->setPage($page);
$pager->init();
$this->pager = $pager;
$actions = array();
$this->actions = $actions;
$this->subtitle = $dept->getName();
$this->counseling = new Counseling();
$this->dept = $dept;
}
示例3: executeList
public function executeList()
{
$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());
$this->can_add = $acl->getAddPriv() == 1;
$this->can_edit = $acl->getEditPriv() == 1;
$this->can_remove = $acl->getRemovePriv() == 1;
$c = new Criteria();
$dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo');
$c->add(ColLocationPeer::DEPARTMENT_ID, $dept->getChildRecurs(), Criteria::IN);
$c->addJoin(ColItemPeer::COL_LOCATION_ID, ColLocationPeer::ID);
$this->sort($c);
if ($this->getRequest()->hasParameter('filters')) {
$filters = $this->getRequestParameter('filters');
if ($filters == 'clear') {
$this->filters = null;
} else {
$defined_filter = false;
foreach ($filters as $f) {
if ($f != null && $f != '') {
$defined_filter = true;
break;
}
}
if ($defined_filter) {
$this->filters = $filters;
$this->filter($c, $this->getRequestParameter('filters'));
}
}
}
#$rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'col_item'));
$this->getUser()->setAttribute('max_per_page', 12, 'col_item');
$pager = new sfPropelPager('ColItem', 12);
$pager->setCriteria($c);
$page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'col_item'));
$this->getUser()->setAttribute('page', $page, 'col_item');
$pager->setPage($page);
$pager->init();
$this->pager = $pager;
$filter_string = "";
if ($this->filters) {
foreach ($this->filters as $key => $val) {
$filter_string .= "&filters[{$key}]={$val}";
}
$filter_string = preg_replace('/^&/', '', $filter_string);
}
$this->filter_string = $filter_string;
$this->subtitle = '';
$actions = array(array('name' => 'cetak', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")));
$this->actions = $actions;
$this->actions3 = array();
}
示例4: executeShowStudent
public function executeShowStudent()
{
$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');
}
$subject = SubjectPeer::retrieveByPk($this->getRequestParameter('id'));
$this->forward404Unless($subject);
$this->subtitle = $subject->toString() . ' - id:' . $subject->getId();
$this->subject = $subject;
}
示例5: executeList
public function executeList()
{
$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_edit = $acl->getEditPriv() == 1;
$this->can_remove = $acl->getRemovePriv() == 1;
$actions = array();
$this->actions = $actions;
$this->byEmployee = false;
$this->subtitle = 'Riwayat Penilaian';
$this->counseling = new Counseling();
}
示例6: executeListByEmployee
public function executeListByEmployee()
{
$group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
$c = new Criteria();
$c->add(JobPeer::CODE, 'counseling/listByEmployee');
$job = JobPeer::doSelectOne($c);
$acl = AclPeer::retrieveByPK($group_id, $job->getId());
if (!$acl) {
$this->forward('default', 'error404');
}
$employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo');
$employee = EmployeePeer::retrieveByPK($employee_id);
$this->forward404Unless($employee);
$dept = $this->getContext()->getUser()->getAttribute('department_id', null, 'bo');
$actions = array();
$this->actions = $actions;
$this->subtitle = $employee->toString();
$this->employee_id = $employee_id;
$this->employee = $employee;
$this->counseling = new Counseling();
}
示例7: executeEdit
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;
$payment_student = PaymentJournalPeer::retrieveByPk($this->getRequestParameter('id'));
$this->forward404Unless($payment_student);
$actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")));
if ($acl->getRemovePriv()) {
array_push($actions, array('name' => 'delete', 'url' => 'payment_student/delete?id=' . $payment_student->getId(), 'color' => 'red'));
}
array_push($actions, array('name' => 'cancel', 'url' => 'payment_student/list', 'color' => 'white'));
$this->subtitle = $payment_student->toString() . ' - id:' . $payment_student->getId();
$this->type = 'edit';
$this->payment_student = $payment_student;
$this->actions = $actions;
$dept = sfContext::getInstance()->getUser()->getAttribute('department', null, 'bo');
$depts = $dept->getChildRecurs(array());
$this->academic_costs = array();
$c = new Criteria();
$c->add(AcademicCalendarPeer::DEPARTMENT_ID, $depts, Criteria::IN);
$c->addJoin(AcademicCalendarPeer::ID, VAcademicCostPeer::ACADEMIC_CALENDAR_ID);
$costs = VAcademicCostPeer::doSelect($c);
foreach ($costs as $cost) {
$academic_costs[$cost->getId()] = $cost->toStringCap();
}
$this->academic_costs = $academic_costs;
}
示例8: executeAchievement
public function executeAchievement()
{
$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->ng_test_applicant = NgTestApplicantPeer::retrieveByPk($this->getRequestParameter('id'));
$this->forward404Unless($this->ng_test_applicant);
$actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")));
if ($acl->getRemovePriv()) {
array_push($actions, array('name' => 'delete', 'url' => 'ng_test_applicant/delete?id=' . $this->ng_test_applicant->getId(), 'color' => 'red'));
}
array_push($actions, array('name' => 'cancel', 'url' => 'ng_test_applicant/list', 'color' => 'black'));
$this->actions = $actions;
$this->subtitle = $this->ng_test_applicant->getName() . ' - id:' . $this->ng_test_applicant->getId();
$this->type = 'edit';
$this->setTemplate('editPhase');
$this->tipe = 'achievement';
$this->title = 'Detail Prestasi';
$this->actions_url = 'ng_test_applicant/saveAchievement';
$this->tab_attr_tmpl = $this->getContext()->getModuleDirectory() . "/templates/tmplTabSuccess.php";
$actions2 = array(array('name' => 'TestApplicant', 'url' => 'ng_test_applicant/list', 'color' => 'sky'));
array_push($actions2, array('name' => 'Identity Detail', 'url' => 'ng_test_applicant/edit?id=' . $this->ng_test_applicant->getId(), 'color' => 'sky'));
array_push($actions2, array('name' => 'Education Detail', 'url' => 'ng_test_applicant/education?id=' . $this->ng_test_applicant->getId(), 'color' => 'sky'));
array_push($actions2, array('name' => 'Parents Detail', 'url' => 'ng_test_applicant/parent?id=' . $this->ng_test_applicant->getId(), 'color' => 'sky'));
array_push($actions2, array('name' => 'Home Detail', 'url' => 'ng_test_applicant/home?id=' . $this->ng_test_applicant->getId(), 'color' => 'sky'));
array_push($actions2, array('name' => 'Medical Detail', 'url' => 'ng_test_applicant/medical?id=' . $this->ng_test_applicant->getId(), 'color' => 'sky'));
array_push($actions2, array('name' => 'Talent Detail', 'url' => 'ng_test_applicant/talent?id=' . $this->ng_test_applicant->getId(), 'color' => 'sky'));
array_push($actions2, array('name' => 'Achievement Detail', 'url' => 'ng_test_applicant/achievement?id=' . $this->ng_test_applicant->getId(), 'color' => 'sun', 'type' => 'direct'));
$this->actions2 = $actions2;
}
示例9: executeEdit
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;
$student = StudentPeer::retrieveByPk($this->getRequestParameter('id'));
$this->forward404Unless($student);
$this->student_detail = $student->getStudentDetail();
$c = new Criteria();
$c->add(StudentTypePeer::STUDENT_ID, $student->getId());
$stu_type = StudentTypePeer::doSelectOne($c);
if ($stu_type) {
$this->student_type = $stu_type;
} else {
$this->student_type = new StudentType();
}
$actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")));
array_push($actions, array('name' => 'cancel', 'url' => 'student_type/list', 'color' => 'black'));
$this->subtitle = $student->toString() . ' - id:' . $student->getId();
$this->type = 'edit';
$this->student = $student;
$this->actions = $actions;
}
示例10: executeEdit
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;
$cat_language = CatLanguagePeer::retrieveByPk($this->getRequestParameter('id'));
$this->forward404Unless($cat_language);
$actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")));
// if ($acl->getAddPriv()) array_push($actions, array('name'=>'copy','type'=>'submit', 'options'=>array('class'=>'save_button', 'onclick'=>"action_type.value=this.value")));
if ($acl->getRemovePriv()) {
array_push($actions, array('name' => 'delete', 'url' => 'cat_language/delete?id=' . $cat_language->getId(), 'color' => 'red'));
}
array_push($actions, array('name' => 'cancel', 'url' => 'cat_language/list', 'color' => 'black'));
$this->subtitle = $cat_language->toString() . ' - id:' . $cat_language->getId();
$this->type = 'edit';
$this->cat_language = $cat_language;
$this->actions = $actions;
}
示例11: executeEdit
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;
$member_type = MemberTypePeer::retrieveByPk($this->getRequestParameter('id'));
$this->forward404Unless($member_type);
$actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")));
// if ($acl->getAddPriv()) array_push($actions, array('name'=>'copy','type'=>'submit', 'options'=>array('class'=>'save_button', 'onclick'=>"action_type.value=this.value")));
if ($acl->getRemovePriv()) {
array_push($actions, array('name' => 'delete', 'url' => 'member_type/delete?id=' . $member_type->getId(), 'color' => 'red'));
}
array_push($actions, array('name' => 'cancel', 'url' => 'member_type/list', 'color' => 'black'));
$this->subtitle = $member_type->toString() . ' - id:' . $member_type->getId();
$this->type = 'edit';
$this->member_type = $member_type;
$this->forward404Unless($this->member_type);
$c = new Criteria();
$this->member_jobs = MemberJobPeer::doSelect($c);
foreach ($this->member_jobs as $member_job) {
$c = new Criteria();
$c->add(MemberJobPeer::PARENT, $member_job->getId());
$c->add(MemberJobPeer::DISPLAY_MENU, true);
$member_job->child = MemberJobPeer::doCount($c);
$c = new Criteria();
$c->add(MemberAclPeer::MEMBER_TYPE_ID, $this->member_type->getId(), Criteria::EQUAL);
$c->add(MemberAclPeer::MEMBER_JOB_ID, $member_job->getId(), Criteria::EQUAL);
$member_job->member_acl = MemberAclPeer::doSelectOne($c);
$member_job->level = $member_job->getLevel();
$member_job->order = $member_job->getMenuOrderRecursive();
}
function sortOrder($a, $b)
{
if ($a->order == $b->order) {
return 0;
}
return $a->order < $b->order ? -1 : 1;
}
usort($this->member_jobs, 'sortOrder');
$this->actions = $actions;
}
示例12: executeEdit
public function executeEdit()
{
$emp_id = $this->getRequestParameter('employee_id');
$emp = EmployeePeer::retrieveByPK($emp_id);
$this->forward404Unless($emp);
$this->employee = $emp;
$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;
$teaching_competency = TeachingCompetencyPeer::retrieveByPk($this->getRequestParameter('id'));
$this->forward404Unless($teaching_competency);
$actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")));
if ($acl->getRemovePriv()) {
array_push($actions, array('name' => 'delete', 'url' => 'teaching_competency/delete?employee_id=' . $emp_id . '&id=' . $teaching_competency->getId(), 'color' => 'red'));
}
array_push($actions, array('name' => 'cancel', 'url' => 'teaching_competency/list?employee_id=' . $emp_id, 'color' => 'white'));
$this->subtitle = $teaching_competency->toString() . ' - id:' . $teaching_competency->getId();
$this->type = 'edit';
$this->teaching_competency = $teaching_competency;
$this->actions = $actions;
}
示例13: executeEdit
public function executeEdit()
{
$group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
$usertype = $this->getContext()->getUser()->getAttribute('usertype', null, 'bo');
$jobtemplate = $this->getContext()->getUser()->getAttribute('job_template_id', null, 'bo');
if ($jobtemplate == 1) {
$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;
$byEmployee = false;
} else {
$c = new Criteria();
$c->add(JobPeer::CODE, 'employee_leave_l');
$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;
$byEmployee = true;
}
$employee_leave = EmployeeLeavePeer::retrieveByPk($this->getRequestParameter('id'));
$this->forward404Unless($employee_leave);
$actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")));
if ($acl->getRemovePriv()) {
array_push($actions, array('name' => 'delete', 'url' => 'employee_leave/delete?id=' . $employee_leave->getId(), 'color' => 'red'));
}
array_push($actions, array('name' => 'cancel', 'url' => 'employee_leave/list?employee_id=' . $employee_leave->getEmployeeId(), 'color' => 'white'));
$this->subtitle = $employee_leave->toString() . ' - id:' . $employee_leave->getId();
$this->type = 'edit';
$this->employee_leave = $employee_leave;
$this->actions = $actions;
$employee = $employee_leave->getEmployee();
if ($byEmployee == false) {
$actions2 = array(array('name' => '<span>Catatan Kepegawaian</span>', 'url' => 'employee_list/list', 'color' => 'sky'));
array_push($actions2, array('name' => '<span>Mutasi Jabatan</span>', 'url' => 'employee_job_history/list?employee_id=' . $employee->getId(), 'color' => 'sky'));
array_push($actions2, array('name' => '<span>Absensi Pegawai</span>', 'url' => 'employee_absence/list?employee_id=' . $employee->getId(), 'color' => 'sky'));
array_push($actions2, array('name' => '<span>Administrasi Cuti</span>', 'url' => 'employee_leave/list?employee_id=' . $employee->getId(), 'color' => 'sun', 'type' => 'direct'));
array_push($actions2, array('name' => '<span>Administrasi Izin</span>', 'url' => 'employee_permit/list?employee_id=' . $employee->getId(), 'color' => 'sky'));
array_push($actions2, array('name' => '<span>Administrasi Pengobatan</span>', 'url' => 'employee_medical/list?employee_id=' . $employee->getId(), 'color' => 'sky'));
array_push($actions2, array('name' => '<span>Gaji Pegawai</span>', 'url' => 'employee_salary/list?employee_id=' . $employee->getId(), 'color' => 'sky'));
$this->actions2 = $actions2;
}
$this->byEmployee = $byEmployee;
}
示例14: executeEdit
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;
}
示例15: executeEdit
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_edit = $acl->getEditPriv() == 1;
$this->can_remove = $acl->getRemovePriv() == 1;
$schedule = SchedulePeer::retrieveByPk($this->getRequestParameter('id'));
$this->forward404Unless($schedule);
$this->setTemplate('edit');
$actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")));
if ($acl->getRemovePriv()) {
array_push($actions, array('name' => 'delete', 'url' => 'extracurricular/delete?id=' . $schedule->getId(), 'color' => 'red'));
}
array_push($actions, array('name' => 'cancel', 'url' => 'extracurricular/list', 'color' => 'black'));
$this->subtitle = $schedule->toStringCap() . ' - id:' . $schedule->getId();
$this->type = 'edit';
$this->schedule = $schedule;
$this->actions = $actions;
$c = new Criteria();
$c->add(ScheduleDetailPeer::SCHEDULE_ID, $schedule->getId());
$c->addDescendingOrderByColumn(ScheduleDetailPeer::ID);
$rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'schedule_detail'));
$this->getUser()->setAttribute('max_per_page', $rpp, 'schedule_detail');
$pager = new sfPropelPager('ScheduleDetail', $rpp);
$pager->setCriteria($c);
$page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'schedule_detail'));
$this->getUser()->setAttribute('page', $page, 'schedule_detail');
$pager->setPage($page);
$pager->init();
$this->pager = $pager;
$actions2 = array(array('name' => 'add', 'url' => 'extracurricular/createSchedule?schedule_id=' . $schedule->getId(), 'color' => 'black'));
$this->actions2 = $actions2;
}