示例#1
0
 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
0
文件: Job.php 项目: taryono/school
 public function getParentName()
 {
     $parent = JobPeer::retrieveByPK($this->getParent());
     if ($parent) {
         return $parent->toString();
     } else {
         return '-';
     }
 }
示例#3
0
 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;
 }
示例#4
0
 public static function retrieveByCode($code, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $criteria = new Criteria(JobPeer::DATABASE_NAME);
     $criteria->add(JobPeer::CODE, $code);
     $v = JobPeer::doSelect($criteria, $con);
     return !empty($v) > 0 ? $v[0] : null;
 }
示例#5
0
 public function executeAddJob(sfWebRequest $request)
 {
     $jobId = $request->getParameter("id");
     $job = JobPeer::retrieveByPK($jobId);
     $profile = $this->getUser()->getProfile();
     $to = "*****@*****.**";
     $subject = $profile->getFirstName() . " " . $profile->getLastName() . " is requestting to be added to job " . $job->getEvent();
     mail($to, $subject, $subject);
     JobPeer::addEmailLogMessage($jobId, "Request to be added", "*****@*****.**");
 }
示例#6
0
 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();
 }
示例#7
0
 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;
 }
示例#8
0
 public static function getJobsForAutocomplete($q)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers('Url');
     $c = new Criteria();
     $crit0 = $c->getNewCriterion(JobPeer::EVENT, $q . '%', Criteria::LIKE);
     $crit1 = $c->getNewCriterion(JobPeer::ID, $q . '%', Criteria::LIKE);
     $crit0->addOr($crit1);
     $c->add($crit0);
     $c->addDescendingOrderByColumn(JobPeer::EVENT);
     $c->setLimit(10);
     $jobs = JobPeer::doSelect($c);
     $arr = array();
     foreach ($jobs as $j) {
         $arr[] = array("name" => $j->getId() . " - " . $j->getEvent(), "url" => url_for('job_show', array("slug" => $j->getSlug())));
     }
     return $arr;
 }
示例#9
0
 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();
 }
示例#10
0
 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();
 }
示例#11
0
 public function executeChartEmployees()
 {
     $data = array();
     foreach (JobPeer::doSelect(new Criteria()) as $job) {
         $c = new Criteria();
         $c->add(EmployeePeer::JOB_ID, $job->getId());
         $data[$job->getName()] = EmployeePeer::doCount($c);
     }
     //To create a bar chart we need to create a stBarOutline Object
     $bar = new stBarOutline(80, '#78B9EC', '#3495FE');
     $bar->key('', 10);
     //Passing the random data to bar chart
     $bar->data = $data;
     //Creating a stGraph object
     $g = new stGraph();
     $g->title('Employee Job Type Break-Down', '{font-size: 20px;}');
     $g->bg_colour = '#FFFFFF';
     $g->set_inner_background('#E3F0FD', '#CBD7E6', 90);
     $g->x_axis_colour('#8499A4', '#E4F5FC');
     $g->y_axis_colour('#8499A4', '#E4F5FC');
     //Pass stBarOutline object i.e. $bar to graph
     $g->data_sets[] = $bar;
     //Setting labels for X-Axis
     $g->set_x_labels(array_keys($data));
     // to set the format of labels on x-axis e.g. font, color, step
     $g->set_x_label_style(10, '#18A6FF', 0, 2);
     // To tick the values on x-axis
     // 2 means tick every 2nd value
     $g->set_x_axis_steps(2);
     //set maximum value for y-axis
     //we can fix the value as 20, 10 etc.
     //but its better to use max of data
     $g->set_y_max(max($data));
     $g->y_label_steps(4);
     $g->set_y_legend('# Employees', 12, '#18A6FF');
     echo $g->render();
     return sfView::NONE;
 }
示例#12
0
 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;
 }
示例#13
0
 public function getNumberOfJobs()
 {
     $c = new Criteria();
     $c->add(JobPeer::PROJECT_ID, $this->getId());
     return JobPeer::doCount($c);
 }
示例#14
0
 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;
     $course_schedule = CourseSchedulePeer::retrieveByPK($this->getRequestParameter('course_id'));
     $this->forward404Unless($course_schedule);
     $course_schedule_id = $course_schedule->getId();
     $grade_options = array();
     $c = new Criteria();
     $c->add(SubjectGradingPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId(), Criteria::IN);
     $c->addAscendingOrderByColumn(SubjectGradingPeer::ID);
     $grades = SubjectGradingPeer::doSelect($c);
     foreach ($grades as $grade) {
         $grade_options[$grade->getId()] = $grade->getGradeComponent()->toString();
     }
     $this->grade_options = $grade_options;
     $class_agenda = ClassAgendaPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($class_agenda);
     $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' => 'class_agenda/delete?id=' . $class_agenda->getId() . '&sched_id=' . $course_schedule->getId(), 'color' => 'red'));
     }
     array_push($actions, array('name' => 'cancel', 'url' => 'class_agenda/list?id=' . $course_schedule->getId(), 'color' => 'black'));
     $this->subtitle = $class_agenda->toString() . ' - id:' . $class_agenda->getId();
     $this->type = 'edit';
     $this->class_agenda = $class_agenda;
     $this->actions = $actions;
     $this->course_schedule_id = $class_agenda->getCourseScheduleId();
     $this->course_schedule = $course_schedule;
     $actions2 = array(array('name' => '<span>Jadwal Pelajaran</span>', 'url' => 'course_sched/list', 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Agenda Kelas</span>', 'url' => 'class_agenda/list?id=' . $course_schedule->getId(), 'color' => 'sun', 'type' => 'direct'));
     $this->actions2 = $actions2;
 }
 /**
  * Get the associated Job object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     Job The associated Job object.
  * @throws     PropelException
  */
 public function getJob(PropelPDO $con = null)
 {
     if ($this->aJob === null && $this->job_id !== null) {
         $c = new Criteria(JobPeer::DATABASE_NAME);
         $c->add(JobPeer::ID, $this->job_id);
         $this->aJob = JobPeer::doSelectOne($c, $con);
         /* The following can be used additionally to
         		   guarantee the related object contains a reference
         		   to this object.  This level of coupling may, however, be
         		   undesirable since it could result in an only partially populated collection
         		   in the referenced object.
         		   $this->aJob->addJobPhotographers($this);
         		 */
     }
     return $this->aJob;
 }
示例#16
0
 /**
  * Selects a collection of Delivery objects pre-filled with all related objects.
  *
  * @param      Criteria  $c
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of Delivery objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     foreach (sfMixer::getCallables('BaseDeliveryPeer:doSelectJoinAll:doSelectJoinAll') as $callable) {
         call_user_func($callable, 'BaseDeliveryPeer', $c, $con);
     }
     $c = clone $c;
     // Set the correct dbName if it has not been overridden
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     DeliveryPeer::addSelectColumns($c);
     $startcol2 = DeliveryPeer::NUM_COLUMNS - DeliveryPeer::NUM_LAZY_LOAD_COLUMNS;
     JobPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (JobPeer::NUM_COLUMNS - JobPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(DeliveryPeer::JOB_ID), array(JobPeer::ID), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = DeliveryPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = DeliveryPeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://propel.phpdb.org/trac/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $omClass = DeliveryPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             DeliveryPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Job rows
         $key2 = JobPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = JobPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = JobPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 JobPeer::addInstanceToPool($obj2, $key2);
             }
             // if obj2 loaded
             // Add the $obj1 (Delivery) to the collection in $obj2 (Job)
             $obj2->addDelivery($obj1);
         }
         // if joined row not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
示例#17
0
 public function executePaymentSlip()
 {
     $stu = StudentPeer::retrieveByPK($this->getRequestParameter('student_id'));
     $job = JobPeer::retrieveByCode($this->getModuleName());
     $academic_process = $job->getAcademicProcess();
     $this->forward404Unless($stu && $job && $academic_process);
     $c = new Criteria();
     $c->add(AcademicProcessPeer::CODE, $academic_process->getCode());
     $c->addJoin(AcademicProcessPeer::ID, AcademicCostPeer::ACADEMIC_PROCESS_ID);
     $c->addJoin(AcademicCostPeer::ACADEMIC_CALENDAR_ID, StudentLeavePeer::ACADEMIC_CALENDAR_ID);
     $c->add(StudentLeavePeer::STATUS, StudentLeave::STATUS_APPROVED);
     $c->add(StudentLeavePeer::STUDENT_ID, $stu->getId());
     $costs = AcademicCostPeer::doSelect($c);
     $total_cost = 0;
     foreach ($costs as $c) {
         $total_cost += $c->getAmount();
     }
     $this->stu = $stu;
     $this->costs = $costs;
     $this->total_cost = $total_cost;
     $this->setViewClass('sfDomPDF');
 }
示例#18
0
 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;
 }
示例#19
0
 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;
 }
示例#20
0
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @return Job[]
  * @throws PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(JobPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(JobPeer::DATABASE_NAME);
         $criteria->add(JobPeer::ID, $pks, Criteria::IN);
         $objs = JobPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
示例#21
0
 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;
 }
示例#22
0
 public function executeListElse()
 {
     $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
     $group = $this->getContext()->getUser()->getAttribute('group', null, 'bo');
     if ($group == 'lector') {
         $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo');
         $employee = EmployeePeer::retrieveByPK($employee_id);
         if ($employee->getStaffTypeId() == 13 || $employee->getStaffTypeId() == 14) {
             $this->can_add == 0;
             $this->can_edit == 0;
             $this->can_remove == 0;
         }
         $this->employee = $employee;
     } else {
         $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;
     }
     $counseling_id = $this->getRequestParameter('counseling_id');
     $counseling = CounselingPeer::retrieveByPK($counseling_id);
     $this->forward404Unless($counseling);
     $c = new Criteria();
     $c->add(VStudentElsePeer::ACADEMIC_CALENDAR_ID, $counseling->getAcademicCalendarId(), Criteria::IN);
     $c->add(VStudentElsePeer::CLASS_GROUP_ID, $counseling->getClassGroupId(), Criteria::IN);
     $c->add(VStudentElsePeer::STATUS, Student::STATUS_GRADUATE, Criteria::NOT_EQUAL);
     $c->add(VStudentElsePeer::STATUS, Student::STATUS_OVERDUE, Criteria::NOT_EQUAL);
     $this->sortElse($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->filterElse($c, $this->getRequestParameter('filters'));
             }
         }
     }
     $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'else'));
     $this->getUser()->setAttribute('max_per_page', $rpp, 'else');
     $pager = new sfPropelPager('VStudentElse', $rpp);
     $pager->setCriteria($c);
     $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'else'));
     $this->getUser()->setAttribute('page', $page, 'else');
     $pager->setPage($page);
     $pager->init();
     $this->pager = $pager;
     $actions = array(array('name' => 'filter', 'color' => 'white'));
     $filter_string = "";
     if ($this->filters) {
         foreach ($this->filters as $key => $val) {
             $filter_string .= "&filters[{$key}]={$val}";
         }
         $filter_string = preg_replace('/^&/', '', $filter_string);
     }
     array_unshift($actions, array('name' => 'back', 'url' => "student_finance/list", 'color' => 'black'));
     array_unshift($actions, array('name' => '_AS_CSV_', 'url' => "student_finance/listElseAsCSV?counseling_id={$counseling_id}&{$filter_string}", 'color' => 'black', 'type' => 'direct'));
     array_unshift($actions, array('name' => '_AS_PDF_', 'url' => "student_finance/listElseAsPDF?counseling_id={$counseling_id}&{$filter_string}", 'color' => 'black', 'type' => 'direct'));
     $this->actions = $actions;
     $this->counseling = $counseling;
     $this->subtitle = $counseling->getAcademicCalendar()->toString() . ' # ' . $counseling->getClassGroup()->toString();
     $actions2 = array(array('name' => '<span>Jurnal Pembayaran Wakaf</span>', 'url' => 'student_finance/listStudent?counseling_id=' . $counseling->getId(), 'color' => 'sky'));
     array_unshift($actions2, array('name' => '<span>Jurnal Keuangan Murid</span>', 'url' => 'student_finance/list', 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Jurnal Pembayaran Infaq</span>', 'url' => 'student_finance/listInfaq?counseling_id=' . $counseling->getId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Jurnal Pembayaran SPP</span>', 'url' => 'student_finance/listSpp?counseling_id=' . $counseling->getId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Jurnal Pembayaran Lain-lain</span>', 'url' => 'student_finance/listElse?counseling_id=' . $counseling->getId(), 'color' => 'sun', 'type' => 'direct'));
     $this->actions2 = $actions2;
 }
示例#23
0
 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;
     $budget_status = BudgetStatusPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($budget_status);
     $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' => 'budget_status/delete?id=' . $budget_status->getId(), 'color' => 'red'));
     }
     array_push($actions, array('name' => 'cancel', 'url' => 'budget_status/list', 'color' => 'white'));
     $this->subtitle = $budget_status->toString() . ' - id:' . $budget_status->getId();
     $this->type = 'edit';
     $this->budget_status = $budget_status;
     $this->actions = $actions;
     $cw = new Criteria();
     $cw->add(JobPeer::PARENT, 240);
     $parent = JobPeer::doSelectOne($cw);
     $cr = new Criteria();
     $cton1 = $cr->getNewCriterion(JobPeer::PARENT, $parent->getParent(), Criteria::IN);
     $cton2 = $cr->getNewCriterion(JobPeer::ID, $job->getId(), Criteria::NOT_IN);
     $cton3 = $cr->getNewCriterion(JobPeer::CODE, 'academic_process', Criteria::NOT_IN);
     $cton4 = $cr->getNewCriterion(JobPeer::CODE, 'payer_type', Criteria::NOT_IN);
     $cton5 = $cr->getNewCriterion(JobPeer::CODE, 'payment_model', Criteria::NOT_IN);
     $cton6 = $cr->getNewCriterion(JobPeer::CODE, 'budget_category', Criteria::NOT_IN);
     $cton5->addAnd($cton6);
     $cton4->addAnd($cton5);
     $cton3->addAnd($cton4);
     $cton2->addAnd($cton3);
     $cton1->addAnd($cton2);
     $cr->add($cton1);
     $modules = JobPeer::doSelect($cr);
     $this->modules = $modules;
     $actions2 = array(array('name' => '<span>Komponen Biaya Sekolah</span>', 'url' => 'academic_cost_component/list', 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Proses Akademik</span>', 'url' => 'academic_process/list', 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Tipe Siswa</span>', 'url' => 'payer_type/list', 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Model Pembayaran</span>', 'url' => 'payment_model/list', 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Kategori Anggaran</span>', 'url' => 'budget_category/list', 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>' . $job->getName() . '</span>', 'url' => $job->getCode(), 'color' => 'sun', 'type' => 'direct'));
     $this->actions2 = $actions2;
 }
示例#24
0
 public function executeList()
 {
     $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
     $cw = new Criteria();
     $cw->add(JobPeer::CODE, $this->getModuleName());
     $job = JobPeer::doSelectOne($cw);
     $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;
     $c = new Criteria();
     $dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo');
     $c->add(EmployeePeer::DEPARTMENT_ID, $dept->getChildRecurs(), Criteria::IN);
     $c->addJoin(VEmployeePermitPeer::EMPLOYEE_ID, EmployeePeer::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(), 'emp_permit'));
     $this->getUser()->setAttribute('max_per_page', $rpp, 'emp_permit');
     $pager = new sfPropelPager('VEmployeePermit', $rpp);
     $pager->setCriteria($c);
     $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'emp_permit'));
     $this->getUser()->setAttribute('page', $page, 'emp_permit');
     $pager->setPage($page);
     $pager->init();
     $this->pager = $pager;
     $actions = array();
     $filter_string = "";
     if ($this->filters) {
         foreach ($this->filters as $key => $val) {
             $filter_string .= "&filters[{$key}]={$val}";
         }
         $filter_string = preg_replace('/^&/', '', $filter_string);
     }
     array_unshift($actions, array('name' => 'Print Excel', 'url' => "employee_permit_recapt/listAsCSV?{$filter_string}", 'color' => 'black', 'type' => 'direct'));
     array_unshift($actions, array('name' => 'Print PDF', 'url' => "employee_permit_recapt/listAsPDF?{$filter_string}", 'color' => 'black', 'type' => 'direct'));
     $this->actions = $actions;
     $this->subtitle = '';
 }
示例#25
0
 public function transformJobs()
 {
     $statusHash = array();
     $statusObjects = StatusPeer::doSelect(new Criteria());
     foreach ($statusObjects as $s) {
         $statusHash[$s->getState()] = $s->getId();
     }
     $this->jobKeys = array();
     $dom = DOMDocument::load("tuftsph_jm2db.xml");
     $jobs = $dom->getElementsByTagName("jobs");
     $total = $jobs->length;
     $count = 1;
     $jobList = array();
     foreach ($jobs as $job) {
         $jid = 0;
         $childNodes = $job->childNodes;
         $j = new Job();
         $del = new Delivery();
         $jid = 1;
         $startTime = null;
         $shootStart = null;
         $shootEnd = null;
         $endTime = null;
         $notes = "";
         $photog = 0;
         $slug = "";
         $childNodes = $job->childNodes;
         foreach ($childNodes as $child) {
             switch ($child->nodeName) {
                 case "id":
                     $jid = $child->textContent;
                     break;
                 case "shoot_name":
                     $j->setEvent($child->textContent);
                     break;
                 case "shoot_date":
                     $j->setDate($child->textContent);
                     break;
                 case "shoot_startT":
                     $startTime = $child->textContent;
                     break;
                 case "shoot_start":
                     $shootStart = $child->textContent;
                     break;
                 case "shoot_endT":
                     $endTime = $child->textContent;
                     break;
                 case "shoot_end":
                     $shootEnd = $child->textContent;
                     break;
                 case "shoot_duedate":
                     $j->setDueDate($child->textContent);
                     break;
                 case "submitted_at":
                     $j->setCreatedAt($child->textContent);
                     break;
                 case "requester_address":
                     $j->setStreet($child->textContent);
                     break;
                 case "requester_campus":
                     $j->setCity($child->textContent);
                     break;
                 case "requester_name":
                     $j->setContactName($child->textContent);
                     break;
                 case "requester_email":
                     $j->setContactEmail($child->textContent);
                     break;
                 case "requester_phone":
                     $j->setContactPhone($child->textContent);
                     break;
                 case "internal_notes":
                     $notes .= $child->textContent . "<br/>";
                     break;
                 case "billing_notes":
                     $notes .= $child->textContent . "<br/>";
                     break;
                 case "estimate":
                     $j->setEstimate($child->textContent);
                     break;
                 case "billing_acctnum":
                     $j->setAcctNum($child->textContent);
                     break;
                 case "billing_deptid":
                     $j->setDeptId($child->textContent);
                     break;
                 case "billing_grantid":
                     $j->setGrantId($child->textContent);
                     break;
                 case "shoot_directions":
                     $j->setOther($child->textContent);
                     break;
                 case "status":
                     $j->setStatusId($statusHash[$child->textContent]);
                     break;
                 case "photog_id":
                     $photog = $child->textContent;
                     break;
                 case "delivery_pubname":
                     $del->setPubName($child->textContent);
                     break;
                 case "delivery_pubtype":
                     $del->setPubType($child->textContent);
                     break;
                 case "delivery_other":
                     $del->setOther($child->textContent);
                     break;
                 case "delivery_format":
                     break;
                 case "delivery_color":
                     $del->setColor($child->textContent);
                     break;
                 case "delivery_format":
                     $del->setFormat($child->textContent);
                     break;
                 case "delivery_size":
                     $del->setSize($child->textContent);
                     break;
                 case "delivery_method":
                     $del->setMethod($child->textContent);
                     break;
                 case "delivery_special":
                     $del->setInstructions($child->textContent);
                     break;
                 case "slug":
                     $slug = $child->textContent;
                     break;
                 case "#text":
                 default:
                     break;
             }
         }
         if (is_null($endTime)) {
             $endTime = $shootEnd;
         }
         if (is_null($startTime)) {
             $startTime = $shootStart;
         }
         if ($j->getCity() == "Boston") {
             $j->setZip("02101");
         } else {
             $j->setZip("02155");
         }
         $j->setNotes($notes);
         $j->setState("Massachusetts");
         list($hour, $min, $sec) = explode(":", $endTime);
         list($shour, $smin, $ssec) = explode(":", $startTime);
         $t = new DateTime();
         $t->setTime($hour, $min, $sec);
         $j->setEndTime($t);
         $t = new DateTime();
         $t->setTime($shour, $smin, $ssec);
         $j->setStartTime($t);
         $j->addTag($slug);
         if (isset($this->jobProjectKeys[$jid])) {
             $j->setProjectId($this->projectKeys[$this->jobProjectKeys[$jid]]);
         }
         while (count($jobList) - 1 != $jid) {
             $jobList[] = false;
         }
         $jobList[intval($jid)] = array("job" => $j, "del" => $del, "photog" => $photog);
     }
     for ($i = 1; $i < count($jobList); $i++) {
         sleep(1);
         $obj = $jobList[$i];
         $c = new Criteria();
         $c->add(JobPeer::ID, $i);
         if (JobPeer::doCount($c) > 0) {
             continue;
         }
         echo $i . "/" . $total . "\n";
         // keep the ids lined up
         if ($obj == false) {
             $myJob = new Job();
             try {
                 $myJob->save();
             } catch (Exception $ex) {
                 echo $ex->getMessage();
             }
             $myJob->delete();
         } else {
             $j = $obj["job"];
             $del = $obj["del"];
             $photog = $obj["photog"];
             try {
                 $j->save();
             } catch (Exception $ex) {
                 echo $ex->getMessage();
                 echo $ex->getTraceAsString();
             }
             $del->setJobId($j->getId());
             $del->save();
             $this->jobKeys[$jid] = $j->getId();
             if ($photog) {
                 $jp = new JobPhotographer();
                 $jp->setPhotographerId($this->photogKeys[$photog]);
                 $jp->setJobId($j->getId());
                 try {
                     $jp->save();
                 } catch (Exception $ex) {
                     echo $ex->getMessage();
                 }
             }
             // add the requester as a client
             $c = new Criteria();
             $c->add(sfGuardUserPeer::USERNAME, $j->getContactEmail());
             if (ClientPeer::doCount($c) == 0 && trim(strlen($j->getContactEmail())) != 0) {
                 $user = new sfGuardUser();
                 $user->setUsername($j->getContactEmail());
                 $user->setPassword("admin");
                 $user->save();
                 $userProfile = new sfGuardUserProfile();
                 $userProfile->setUserId($user->getId());
                 $userProfile->setUserTypeId(sfConfig::get("app_user_type_client"));
                 $userProfile->save();
                 $clientProfile = new Client();
                 $clientProfile->setUserId($userProfile->getId());
                 $clientProfile->setName($j->getContactName());
                 $clientProfile->setEmail($j->getContactEmail());
                 $clientProfile->setPhone($j->getContactPhone());
                 $clientProfile->save();
                 $jobClient = new JobClient();
                 $jobClient->setClientId($clientProfile->getId());
                 $jobClient->setJobId($j->getId());
                 $jobClient->save();
             }
         }
         $count += 1;
     }
 }
示例#26
0
 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;
 }
示例#27
0
 public function getJob($con = null)
 {
     include_once 'lib/model/om/BaseJobPeer.php';
     if ($this->aJob === null && $this->job_id !== null) {
         $this->aJob = JobPeer::retrieveByPK($this->job_id, $con);
     }
     return $this->aJob;
 }
示例#28
0
 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;
     $class_agenda = ClassAgendaPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($class_agenda);
     $this->subtitle = '';
     if (sfContext::getInstance()->getUser()->getAttribute('usertype', null, 'bo') == 'lector') {
         $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo');
         $employee = EmployeePeer::retrieveByPK($employee_id);
         $this->forward404Unless($employee);
         $this->subtitle = $employee->toString();
         $this->employee_id = $employee_id;
     }
     $accal_options = array();
     $c = new Criteria();
     $dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo');
     $c->add(AcademicCalendarPeer::DEPARTMENT_ID, $dept->getChildRecurs(), Criteria::IN);
     $c->addDescendingOrderByColumn(AcademicCalendarPeer::CODE);
     $accals = AcademicCalendarPeer::doSelect($c);
     foreach ($accals as $accal) {
         if ($accal->getParent() != null) {
             $accal_options[$accal->getId()] = '&middot;&nbsp;&nbsp;' . $accal->toString();
         } else {
             $accal_options[$accal->getId()] = $accal->toString();
         }
     }
     $this->accal_options = $accal_options;
     $this->actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")), array('name' => 'cancel', 'url' => 'agenda/list', 'color' => 'black'));
     $this->subtitle = '';
     $this->type = 'add';
     $this->class_agenda = $class_agenda;
     $c = new Criteria();
     $c->add(SubjectGradingPeer::SUBJECT_CURR_ID, $class_agenda->getCourseSchedule()->getSubjectCurrId(), Criteria::IN);
     $c->addAscendingOrderByColumn(SubjectGradingPeer::ID);
     $objs = SubjectGradingPeer::doSelect($c);
     $grades = array();
     foreach ($objs as $o) {
         $grades[$o->getId()] = $o->getGradeComponent()->toString();
     }
     $this->grades = $grades;
     $this->selected_grade = $class_agenda->getSubjectGradingId();
     $scheds_options = array();
     $c = new Criteria();
     $c->add(CourseScheduleTutorPeer::EMPLOYEE_ID, $employee_id, Criteria::IN);
     $c->add(CourseSchedulePeer::ACADEMIC_CALENDAR_ID, $class_agenda->getCourseSchedule()->getAcademicCalendarId(), Criteria::IN);
     $c->addJoin(CourseSchedulePeer::ID, CourseScheduleTutorPeer::COURSE_SCHEDULE_ID);
     $c->addJoin(CourseScheduleDetailPeer::COURSE_SCHEDULE_ID, CourseSchedulePeer::ID);
     $c->addAscendingOrderByColumn(CourseScheduleDetailPeer::CLASS_SESSION_ID);
     $csds = CourseScheduleDetailPeer::doSelect($c);
     foreach ($csds as $csd) {
         $scheds_options[$csd->getCourseScheduleId()] = $csd->getCourseSchedule()->getSubjectCurr()->getSubject()->getName() . ' # ' . $csd->getCourseSchedule()->getClassGroup()->getName();
     }
     $this->scheds = $scheds_options;
     $this->selected_sched = $class_agenda->getCourseScheduleId();
     $c = new Criteria();
     $cton4 = $c->getNewCriterion(StudentAbsencePeer::END, $class_agenda->getDate(), Criteria::IN);
     $cton3 = $c->getNewCriterion(StudentAbsencePeer::START, $class_agenda->getDate(), Criteria::IN);
     $cton2 = $c->getNewCriterion(StudentAbsencePeer::ACADEMIC_CALENDAR_ID, $class_agenda->getCourseSchedule()->getAcademicCalendarId(), Criteria::IN);
     $cton1 = $c->getNewCriterion(StudentAbsencePeer::CLASS_GROUP_ID, $class_agenda->getClassGroupId(), Criteria::IN);
     $cton3->addOr($cton4);
     $cton2->addAnd($cton3);
     $cton1->addAnd($cton2);
     $c->add($cton1);
     $this->student_absences = StudentAbsencePeer::doSelect($c);
     $this->stu_count = StudentAbsencePeer::doCount($c);
 }
示例#29
0
 public function executeGetCounseling()
 {
     $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;
     $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');
     $dept_id = $this->getContext()->getUser()->getAttribute('department', null, 'bo');
     $academic_calendar_id = $this->getRequestParameter('academic_calendar_id');
     $academic_calendar = AcademicCalendarPeer::retrieveByPK($academic_calendar_id);
     $this->forward404Unless($academic_calendar);
     $c = new Criteria();
     $c->add(AcademicCalendarPeer::DEPARTMENT_ID, $dept_id->getChildRecurs(), Criteria::IN);
     $c->add(AcademicCalendarPeer::ID, $academic_calendar->getParent(), Criteria::IN);
     $c->addJoin(CounselingPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::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(), 'counseling'));
     $this->getUser()->setAttribute('max_per_page', $rpp, 'counseling');
     $pager = new sfPropelPager('Counseling', $rpp);
     $pager->setCriteria($c);
     $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'counseling'));
     $this->getUser()->setAttribute('page', $page, 'counseling');
     $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->subtitle = $employee->getName() . ' - ' . $academic_calendar->getName();
     $actions = array();
     $this->actions = $actions;
     $this->academic_calendar = $academic_calendar;
     $this->employee_id = $employee_id;
     $this->employee = $employee;
 }
示例#30
0
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = JobPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setUserId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setChartId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setStatus($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setCreatedAt($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setDoneAt($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setType($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setParameter($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setFailReason($arr[$keys[8]]);
     }
 }