Exemplo n.º 1
0
 public function executeEnquirer()
 {
     $this->applicant = $this->applicant;
     $this->error = false;
     $this->department = DepartmentPeer::retrieveByPK($this->applicant->getDepartment1());
     $this->classGroup = ClassGroupPeer::retrieveByPK($this->applicant->getClassGroup1());
 }
Exemplo n.º 2
0
 public function departmentAvailable($id)
 {
     $return = array();
     $current = DepartmentPeer::retrieveByPK($id);
     if ($current) {
         $return[] = $id;
     } else {
         return null;
     }
     $childCriteria = new Criteria();
     $childCriteria->add(DepartmentPeer::PARENT, $id, Criteria::EQUAL);
     $child = DepartmentPeer::doSelect($childCriteria);
     if (!$child) {
         return $return;
     }
     $childArray = array();
     foreach ($child as $c) {
         $return[] = $c->getId();
         $childArray[] = $c->getId();
     }
     $moreChildCriteria = new Criteria();
     $moreChildCriteria->add(DepartmentPeer::PARENT, $childArray, Criteria::IN);
     $moreChild = DepartmentPeer::doSelect($moreChildCriteria);
     if (!$moreChild) {
         return $return;
     }
     foreach ($moreChild as $c) {
         $return[] = $c->getId();
     }
     return $return;
     //$moreChildCriteria = new Criteria()
 }
Exemplo n.º 3
0
 public function getAllParentDepartmentId($departmentId)
 {
     $thisDepartment = DepartmentPeer::retrieveByPK($departmentId);
     if (!$thisDepartment) {
         if (SF_ENVIRONMENT == 'dev') {
             echo 'department dengan id ' . $departmentId . ' tidak ditemukan';
         }
         return false;
     }
     $department = array();
     $department[] = $thisDepartment->getId();
     $current = $thisDepartment;
     $stop = false;
     $n = 0;
     while (!$stop) {
         if ($current->getParent() < 1) {
             $stop = true;
             break;
         }
         $parent = DepartmentPeer::retrieveByPK($current->getParent());
         if (!$parent) {
             $stop = true;
             break;
         } else {
             $department[] = $parent->getId();
             $current = $parent;
         }
     }
     return $department;
 }
Exemplo n.º 4
0
 public function generateApplicantCode($status, $department)
 {
     $year = date('Y');
     $month = date('m');
     if ($status != NgStatusApplicant::CONFIRMED) {
         $code_appl = 'REG';
     } else {
         $code_appl = 'FRM';
     }
     $dept_code = DepartmentPeer::retrieveByPK($department)->getNumCode() . '-';
     $stu_code = ParamsPeer::retrieveByCode('applicant_code');
     $sc = $stu_code->getValue();
     $sc = explode('$', $sc);
     array_shift($sc);
     $code_len = 0;
     $code = '';
     foreach ($sc as $k => $v) {
         $v = explode('#', $v);
         if ($v[0] == 'app') {
             $code_len += $v[1];
             $code .= str_pad($code_appl, $v[1], '0', STR_PAD_LEFT);
         } elseif ($v[0] == 'dept') {
             $code .= str_pad($dept_code, $v[1], '0', STR_PAD_LEFT);
             $code_len += $v[1];
         } elseif ($v[0] == 'year') {
             if (strlen($year) <= $v[1]) {
                 $code .= str_pad($year, $v[1], '0', STR_PAD_LEFT);
             } else {
                 $code .= substr($year, strlen($year) - $v[1]);
             }
             $code_len += $v[1];
         } elseif ($v[0] == 'month') {
             if (strlen($month) <= $v[1]) {
                 $code .= str_pad($month, $v[1], '0', STR_PAD_LEFT);
             } else {
                 $code .= substr($month, strlen($month) - $v[1]);
             }
             $code_len += $v[1];
         } elseif ($v[0] == 'seq') {
             $c = new Criteria();
             $c->add(NgTestApplicantPeer::CODE, $code . '%', Criteria::LIKE);
             $c->addDescendingOrderByColumn(NgTestApplicantPeer::CODE);
             $c->setLimit(1);
             $last_applicant = NgTestApplicantPeer::doSelectOne($c);
             if ($last_applicant) {
                 $lap = $last_applicant->getCode();
                 $lap = substr_replace($lap, '', 0, $code_len);
                 $lap = substr($lap, 0, $v[1]);
                 $lap++;
                 $code .= str_pad($lap, $v[1], '0', STR_PAD_LEFT);
             } else {
                 $code .= str_pad(1, $v[1], '0', STR_PAD_LEFT);
                 break;
             }
         }
         $sc[$k] = $v;
     }
     return $code;
 }
Exemplo n.º 5
0
 public function getCourseModelRecurs()
 {
     if (!$this->getCourseModel()) {
         if ($this->getParent()) {
             $p = DepartmentPeer::retrieveByPK($this->getParent());
             return $p->getCourseModelRecurs();
         }
         return self::CM_CUSTOM;
     }
     return $this->getCourseModel();
 }
Exemplo n.º 6
0
 /**
  * Implementation for 'GET' method for Rest API
  *
  * @param  mixed $depUid Primary key
  *
  * @return array $result Returns array within multiple records or a single record depending if
  *                       a single selection was requested passing id(s) as param
  */
 protected function get($depUid = null)
 {
     $result = array();
     try {
         $noArguments = true;
         $argumentList = func_get_args();
         foreach ($argumentList as $arg) {
             if (!is_null($arg)) {
                 $noArguments = false;
             }
         }
         if ($noArguments) {
             $criteria = new Criteria('workflow');
             $criteria->addSelectColumn(DepartmentPeer::DEP_UID);
             $criteria->addSelectColumn(DepartmentPeer::DEP_PARENT);
             $criteria->addSelectColumn(DepartmentPeer::DEP_MANAGER);
             $criteria->addSelectColumn(DepartmentPeer::DEP_LOCATION);
             $criteria->addSelectColumn(DepartmentPeer::DEP_STATUS);
             $criteria->addSelectColumn(DepartmentPeer::DEP_REF_CODE);
             $criteria->addSelectColumn(DepartmentPeer::DEP_LDAP_DN);
             $dataset = AppEventPeer::doSelectRS($criteria);
             $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
             while ($dataset->next()) {
                 $result[] = $dataset->getRow();
             }
         } else {
             $record = DepartmentPeer::retrieveByPK($depUid);
             if ($record) {
                 $result = $record->toArray(BasePeer::TYPE_FIELDNAME);
             } else {
                 $paramValues = "";
                 foreach ($argumentList as $arg) {
                     $paramValues .= strlen($paramValues) ? ', ' : '';
                     if (!is_null($arg)) {
                         $paramValues .= "{$arg}";
                     } else {
                         $paramValues .= "NULL";
                     }
                 }
                 throw new RestException(417, "table Department ({$paramValues})");
             }
         }
     } catch (RestException $e) {
         throw new RestException($e->getCode(), $e->getMessage());
     } catch (Exception $e) {
         throw new RestException(412, $e->getMessage());
     }
     return $result;
 }
Exemplo n.º 7
0
 public function signInTestApplicant($user)
 {
     $this->addCredential('bo');
     $this->setAttribute('user_id', $user->getId(), 'bo');
     $this->setAttribute('username_long', $user->getName(), 'bo');
     $this->setAuthenticated2(true, 'bo');
     $this->setAttribute('username', $user->getCode(), 'bo');
     $this->setAttribute('department_id1', DepartmentPeer::retrieveByPK($user->getDepartment1())->getId(), 'bo');
     $this->setAttribute('department1_name', DepartmentPeer::retrieveByPK($user->getDepartment1())->getName(), 'bo');
     #$this->setAttribute('department_id2', $user->getDepartment2()? DepartmentPeer::retrieveByPK($user->getDepartment2())->getId() : '', 'bo');
     #$this->setAttribute('department2_name', $user->getDepartment2()? DepartmentPeer::retrieveByPK($user->getDepartment2())->getName() : '', 'bo');
     $this->setAttribute('class_name1', ClassGroupPeer::retrieveByPK($user->getClassGroup1())->getName(), 'bo');
     $this->setAttribute('class_parent1', ClassGroupPeer::retrieveByPK($user->getClassGroup1())->getParentName(), 'bo');
     #$this->setAttribute('class_name2', $user->getClassGroup2()? ClassGroupPeer::retrieveByPK($user->getClassGroup2())->getName() : '', 'bo');
     #$this->setAttribute('class_parent2', $user->getClassGroup2()? ClassGroupPeer::retrieveByPK($user->getClassGroup2())->getParentName() : '', 'bo');
     $this->setAttribute('login_time', time(), 'bo');
 }
Exemplo n.º 8
0
 public function executeSearchByDepartment(sfWebRequest $request)
 {
     $conn = Propel::getConnection();
     $this->searchType = searchActions::SEARCH_BY_DEPARTMENT;
     $rawDeptList = DepartmentPeer::getAll($conn);
     $deptList = array();
     foreach ($rawDeptList as $obj) {
         $deptList[$obj->getId()] = $obj->getId();
     }
     $this->deptList = $deptList;
     if ($request->hasParameter("deptId")) {
         $deptId = $request->getParameter("deptId");
         if (helperFunctions::isMaliciousString($deptId)) {
             $this->forward404();
         }
         $this->deptId = $deptId;
         $deptObj = DepartmentPeer::retrieveByPK($deptId, $conn);
         $this->resultTitle = "Results for " . $deptObj->getId() . " (" . $deptObj->getDescr() . ")";
         $this->results = $deptObj->getCourses(null, $conn);
     } else {
         $this->deptId = $rawDeptList[0]->getId();
     }
 }
Exemplo n.º 9
0
                            </td>
        				</tr>
        			</table>
        			</td>
        			<td width="50%" class="first">
        			<table border="0" width="100%">
        				<tr>
           					<td class="first" style="vertical-align:middle;" width="30%"><label><?php 
echo __('Department_2');
?>
</label></td>
           					<td class="first" width="2%" style="text-align:center; vertical-align:middle;">:</td>
		   					<td class="first" style="vertical-align:middle;">
                            <p class="detail">
                            	<b><?php 
echo $test_applicant->getDepartment2() ? DepartmentPeer::retrieveByPK($test_applicant->getDepartment2())->toString() : '-';
?>
</b></p>
           					</td>
        				</tr>
        				<tr>   
           					<td style="vertical-align:middle;" width="30%"><label><?php 
echo __('Class Group');
?>
</label></td>
           					<td width="2%" style="text-align:center; vertical-align:middle;">:</td>
		   					<td style="vertical-align:middle;">
           					<p class="detail"><b>
                            	<?php 
echo $test_applicant->getClassGroup2() ? ClassGroupPeer::retrieveByPK($test_applicant->getClassGroup2())->toString() : '-';
?>
Exemplo n.º 10
0
 public function executeGetByDepartment()
 {
     $dept_id = $this->getRequestParameter('department_id');
     $dept = DepartmentPeer::retrieveByPK($dept_id);
     $this->forward404Unless($dept);
     $c = new Criteria();
     $c->add(AcademicCalendarPeer::CURRICULUM_ID, CurriculumPeer::ID);
     $c->add(CurriculumPeer::DEPARTMENT_ID, $dept_id);
     $objs = AcademicCalendarPeer::doSelectFiltered($c);
     $array = array();
     if ($this->getRequestParameter('include_blank') == 'true') {
         $array[] = '';
     }
     foreach ($objs as $obj) {
         $array[$obj->getId()] = $obj->toString();
     }
     $this->content = $array;
     $this->setTemplate('buildOptions');
 }
Exemplo n.º 11
0
    ?>
</div>
					<div style="float:left; width: 50%;">
						<h2 class="titlesubmenu">Username</h2>
						<h3 class="titletext"><?php 
    echo $this->getContext()->getUser()->getAttribute('username', '', 'bo');
    ?>
</h3>
						<h2 class="titlesubmenu">Role</h2>
						<h3 class="titletext"><?php 
    echo UserGroupPeer::retrieveByPK($this->getContext()->getUser()->getAttribute('group_id', '', 'bo'))->getName();
    ?>
</h3>
						<h2 class="titlesubmenu">Tingkat</h2>
						<h3 class="titletext"><?php 
    echo DepartmentPeer::retrieveByPK($this->getContext()->getUser()->getAttribute('department_id', '', 'bo'))->getName();
    ?>
</h3>
	                </div>
	            </div>
				<?php 
    $c = new Criteria();
    $dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo');
    $c->add(PublicInformationPeer::DEPARTMENT_ID, $dept->getChildRecurs(), Criteria::IN);
    $c->add(PublicInformationPeer::PUBLISHED, 1, Criteria::IN);
    $information = PublicInformationPeer::doSelect($c);
    ?>
	            <div class="home_news">
					<h1 class="titlecontent"><?php 
    echo __('PublicInformation');
    ?>
Exemplo n.º 12
0
</td>
				<td class='first' nowrap>
				<?php 
        echo DepartmentPeer::retrieveByPK($test_applicant->getDepartment1())->toString() . ' (' . $test_applicant->getIsPass1() . '-' . $test_applicant->getRank1() . ')';
        ?>
</td>
				<td class='first'><?php 
        echo ClassGroupPeer::retrieveByPK($test_applicant->getClassGroup1())->toString();
        ?>
</td>
				<td class='first'><?php 
        echo $test_applicant->getRegTestPeriod1() ? RegTestPeriodPeer::retrieveByPK($test_applicant->getRegTestPeriod1())->getRegPeriod()->getName() : '-';
        ?>
</td>
				<td nowrap><?php 
        echo $test_applicant->getDepartment2() ? DepartmentPeer::retrieveByPK($test_applicant->getDepartment2())->toString() . ' (' . $test_applicant->getIsPass1() . '-' . $test_applicant->getRank1() . ')' : '-';
        ?>
</td>
				<td><?php 
        echo $test_applicant->getClassGroup2() ? ClassGroupPeer::retrieveByPK($test_applicant->getClassGroup2())->toString() : '-';
        ?>
</td>
				<td><?php 
        echo $test_applicant->getRegTestPeriod2() ? RegTestPeriodPeer::retrieveByPK($test_applicant->getRegTestPeriod2())->getRegPeriod()->getName() : '-';
        ?>
</td>
				<td ><?php 
        if ($test_applicant->getApplicantType() == TestApplicant::STATUS_NEW) {
            echo __('Baru');
        } elseif ($test_applicant->getApplicantType() == TestApplicant::STATUS_TRANSFER) {
            echo __('Pindahan');
Exemplo n.º 13
0
 public function save($param)
 {
     $department_id = $param['department_id'];
     $departmentAvailable = $this->tools->departmentAvailable($department_id);
     $article = new WebArticle();
     if (empty($param['section'])) {
         $this->jsonwrapper->show_json_error('section', 'Kolom section harap diisi.');
     }
     $articleSection = DepartmentPeer::retrieveByPK($param['section']);
     if (!$articleSection) {
         $this->jsonwrapper->show_json_error('type', 'Kolom article type harap diisi.');
     }
     if (!in_array($param['section'], $departmentAvailable)) {
         $this->jsonwrapper->show_json_error('forbidden', 'Maaf, anda tidak dapat membuat article dalam section ini.');
     }
     if (empty($param['title'])) {
         $this->jsonwrapper->show_json_error('title', 'Kolom title harap diisi.');
     }
     if (empty($param['initial'])) {
         $this->jsonwrapper->show_json_error('initial', 'Kolom initial harap diisi.');
     }
     if (empty($param['description'])) {
         $this->jsonwrapper->show_json_error('description', 'Kolom description harap diisi.');
     }
     if (!empty($param['id'])) {
         $article = WebArticlePeer::retrieveByPK($param['id']);
         if (!$article) {
             $this->jsonwrapper->show_json_error('id', 'Article tidak ditemukan.');
         }
         if (!in_array($article->getDepartmentId(), $departmentAvailable)) {
             $this->jsonwrapper->show_json_error('forbidden', 'Maaf, anda tidak dapat mengedit article ini.');
         }
     } else {
         $article->setPublished(0);
         $article->setCreated(date('Y-m-d H:i:s'));
     }
     /* Add */
     $article->setTitle($param['title']);
     $article->setInitial($param['initial']);
     $article->setDepartmentId($param['section']);
     $article->setDescription($param['description']);
     if (!$article->validate()) {
         var_dump($article->validate());
     }
     $article->save();
     $output = array('success' => 1, 'data' => $param);
     $this->jsonwrapper->print_json($output);
 }
 /**
  * Start browsing the directory and register files
  *
  * @return       Exception code = 400 if directory non-existent
  *               An array containing list of non-imported files if successful
  */
 public function doImport()
 {
     if (!file_exists($this->_dir)) {
         throw new Exception("directory non-existent", 400);
     }
     $errArr = array();
     $handler = opendir($this->_dir);
     // TODO: does not do recrusive listing, do we need that?
     while (false !== ($file = readdir($handler))) {
         if ($file != '.' && $file != '..') {
             $err = false;
             $pos = strrpos($file, '.');
             $fileName = strtoupper(substr($file, 0, $pos));
             $token = strtok($fileName, '_');
             $counter = 0;
             while (false !== $token) {
                 switch ($counter) {
                     case 0:
                         if (strlen($token) != 7) {
                             $err = true;
                         }
                         $rawCourseCode = $token;
                         break;
                     case 1:
                         if ($token != substr($this->_year, 0, 4)) {
                             $err = true;
                         }
                         break;
                     case 2:
                         if ($token != "EXAM") {
                             if (substr($token, 0, 5) == "EXAM(") {
                                 // name could have the following syntax: AER205S_2009_EXAM(2).pdf
                                 $count = strtok($token, '(');
                                 $count = strtok('(');
                                 $count = strtok($count, ')');
                                 if ($count === false || !is_numeric($count)) {
                                     $err = true;
                                 }
                             } else {
                                 $err = true;
                             }
                         }
                         break;
                 }
                 $token = strtok("_");
                 $counter++;
             }
             if ($counter != 3 || $err) {
                 $err = true;
             } else {
                 // assume course code is 7 chars in length with the last char being either S, F or Y
                 $part1 = substr($rawCourseCode, 0, 6);
                 //e.g. AER205
                 $part2 = substr($rawCourseCode, 6, 1);
                 //e.g. F
                 switch ($part2) {
                     case "F":
                     case "S":
                         $courseCode = $part1 . "H1";
                         $descr = $part1 . " " . $this->_year . " Official Exam" . (isset($count) ? ' (' . $count . ')' : '');
                         break;
                     case "Y":
                         $courseCode = $part1 . "Y1";
                         $descr = $part1 . " " . $this->_year . " Official Exam" . (isset($count) ? ' (' . $count . ')' : '');
                         break;
                     default:
                         $err = true;
                         break;
                 }
                 if (!$err) {
                     $conn = Propel::getConnection();
                     // check if we have exam of this descr already
                     $examArr = ExamPeer::getExamsForYearAndCourseId($courseCode, $this->_year, $conn);
                     foreach ($examArr as $ex) {
                         if ($ex->getType() == EnumItemPeer::EXAM && $ex->getDescr() == $descr) {
                             $err = true;
                             break;
                         }
                     }
                     if (!$err) {
                         // first check if course exists
                         $course = CoursePeer::retrieveByPK($courseCode, $conn);
                         if (!isset($course)) {
                             $course = new Course();
                             //$course->setDeptId(substr($courseCode, 0, 3));
                             $course->setDescr($courseCode);
                             $course->setIsEng(1);
                             $course->setId($courseCode);
                             $dept = DepartmentPeer::retrieveByPK(substr($courseCode, 0, 3), $conn);
                             if (!isset($dept)) {
                                 $dept = new Department();
                                 $dept->setId(substr($courseCode, 0, 3));
                                 $dept->setDescr(substr($courseCode, 0, 3));
                                 $dept->save($conn);
                             }
                             $course->setDepartment($dept);
                             $course->save($conn);
                         }
                         // register exam
                         $exam = new Exam();
                         $exam->setType(EnumItemPeer::EXAM);
                         $exam->setDescr($descr);
                         $exam->setCourseId($courseCode);
                         $exam->setFilePath($this->_dir . $file);
                         $exam->setYear($this->_year);
                         $exam->save();
                     }
                 }
             }
             if ($err) {
                 $errArr[] = $file;
             }
         }
     }
     closedir($handler);
     return $errArr;
 }
Exemplo n.º 15
0
 /**
  * Remove the row
  *
  * @param array $aData or string $ProUid
  * @return string
  *
  */
 public function remove($ProUid)
 {
     if (is_array($ProUid)) {
         $ProUid = isset($ProUid['DEP_UID']) ? $ProUid['DEP_UID'] : '';
     }
     try {
         $oCriteria = new Criteria('workflow');
         $oCriteria->addSelectColumn(UsersPeer::USR_UID);
         $oCriteria->add(UsersPeer::DEP_UID, $ProUid, Criteria::EQUAL);
         $oDataset = UsersPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         $aFields = array();
         while ($aRow = $oDataset->getRow()) {
             $aFields['USR_UID'] = $aRow['USR_UID'];
             $aFields['DEP_UID'] = '';
             $oDepto = UsersPeer::retrieveByPk($aFields['USR_UID']);
             if (is_object($oDepto) && get_class($oDepto) == 'UsersPeer') {
                 return true;
             } else {
                 $oDepto = new Users();
                 $oDepto->update($aFields);
             }
             $oDataset->next();
         }
         $oPro = DepartmentPeer::retrieveByPK($ProUid);
         if (!is_null($oPro)) {
             $dptoTitle = $this->Load($oPro->getDepUid());
             Content::removeContent('DEPO_TITLE', '', $oPro->getDepUid());
             Content::removeContent('DEPO_DESCRIPTION', '', $oPro->getDepUid());
             G::auditLog("DeleteDepartament", "Departament Name: " . $dptoTitle['DEPO_TITLE'] . " Departament ID: (" . $oPro->getDepUid() . ") ");
             return $oPro->delete();
         } else {
             throw new Exception("The row '{$ProUid}' in table Group doesn't exist!");
         }
     } catch (Exception $oError) {
         throw $oError;
     }
 }
Exemplo n.º 16
0
 public function executeSelectPeriodByDept()
 {
     $dept_id = $this->getRequestParameter('department_id');
     $department = DepartmentPeer::retrieveByPK($dept_id);
     $c = new Criteria();
     $c->add(AcademicCalendarPeer::DEPARTMENT_ID, $this->getRequestParameter('department_id'));
     $c->addJoin(NgRegPeriodPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID);
     $c->add(NgRegPeriodPeer::STATUS, NgRegPeriod::OPEN);
     $nrps = NgRegPeriodPeer::doSelect($c);
     $content = array();
     foreach ($nrps as $r) {
         $content[$r->getId()] = $r->toString();
     }
     $this->content = $content;
     $this->disabled = $disabled;
 }
Exemplo n.º 17
0
 public function executeGetApplSched()
 {
     $this->ng_reg_period = NgRegPeriodPeer::retrieveByPK($this->getRequestParameter('ng_reg_period_id'));
     $this->forward404Unless($this->ng_reg_period);
     $this->ng_reg_test_period = NgRegTestPeriodPeer::retrieveByPK($this->getRequestParameter('ng_reg_test_period_id'));
     $this->forward404Unless($this->ng_reg_test_period);
     $this->ng_test_schedule = NgTestSchedulePeer::retrieveByPK($this->getRequestParameter('ng_test_schedule_id'));
     $this->forward404Unless($this->ng_test_schedule);
     $ct = new Criteria();
     $ct->add(NgTestSubjectPeer::COURSE_MODEL, DepartmentPeer::retrieveByPK($this->ng_reg_period->getAcademicCalendar()->getDepartmentId())->getCourseModel());
     $this->test_subjects = NgTestSubjectPeer::doSelect($ct);
     $c = new Criteria();
     $c->add(NgTestApplSchedPeer::NG_TEST_SCHEDULE_ID, $this->ng_test_schedule->getId());
     $c->addJoin(NgTestApplicantPeer::ID, NgTestApplSchedPeer::NG_TEST_APPLICANT_ID);
     $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'applicant'));
     $this->getUser()->setAttribute('max_per_page', $rpp, 'applicant');
     $pager = new sfPropelPager('NgTestApplicant', $rpp);
     $pager->setCriteria($c);
     $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'applicant'));
     $this->getUser()->setAttribute('page', $page, 'applicant');
     $pager->setPage($page);
     $pager->init();
     $this->pager = $pager;
     $this->type = 'edit';
     $this->actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")), array('name' => 'cancel', 'url' => 'ng_reg_detail/listTest?id=' . $this->ng_reg_period->getId(), 'color' => 'black'));
 }
Exemplo n.º 18
0
 /**
  * setDepartment function
  * function to set the department
  * @param int $departmentId
  */
 public function setDepartment($departmentId)
 {
     $this->department = DepartmentPeer::retrieveByPK($departmentId);
 }
Exemplo n.º 19
0
 public function saveToDatabase()
 {
     if (isset($this->_infoArr) && isset($this->_mappingArr)) {
         $err = "";
         $conn = Propel::getConnection();
         $dt = date("Y-m-d H:i:s");
         $len = count($this->_infoArr);
         for ($i = 0; $i < $len; $i++) {
             $courseCode = substr($this->_infoArr[$i]["courseCode"], 0, 8);
             $deptId = substr($courseCode, 0, 3);
             $deptObj = DepartmentPeer::retrieveByPK($deptId, $conn);
             if (!isset($deptObj)) {
                 // new department found, save to db
                 $deptObj = new Department();
                 $deptObj->setId($deptId);
                 $deptObj->setDescr($deptId);
                 $deptObj->save($conn);
             }
             $course = CoursePeer::retrieveByPK($courseCode, $conn);
             if (!isset($course)) {
                 // new course found, save to db
                 $course = new Course();
                 $course->setDescr($this->_infoArr[$i]["courseName"]);
                 $course->setIsEng(1);
                 $course->setDeptId($deptId);
                 $course->setId($courseCode);
                 $course->save($conn);
             } elseif ($course->getDescr() == $course->getId()) {
                 // exam importer registers course description as course id
                 // if we encounter this situation, amend it with the proper description
                 $course->setDescr($this->_infoArr[$i]["courseName"]);
                 $course->save($conn);
             }
             try {
                 $instr = InstructorPeer::findInstructorByName($this->_infoArr[$i]["instrFirstName"], $this->_infoArr[$i]["instrLastName"], $conn);
             } catch (Exception $e) {
                 if ($e->getCode() == 1) {
                     // no instructor found
                     $instr = new Instructor();
                     $instr->setFirstName($this->_infoArr[$i]["instrFirstName"]);
                     $instr->setLastName($this->_infoArr[$i]["instrLastName"]);
                     $instr->setDeptId($course->getDeptId());
                     $instr->save($conn);
                 } else {
                     // TODO: big problem, duplicate instructors found
                     // log error and move on
                     continue;
                 }
             }
             // create CourseInstructorAssociation if it doesn't exist
             try {
                 $assoc = CourseInstructorAssociationPeer::findForYearAndInstructorIdAndCourseId($this->_year, $course->getId(), $instr->getId(), $conn);
             } catch (Exception $e) {
                 if ($e->getCode() == 1) {
                     // create new object
                     $assoc = new CourseInstructorAssociation();
                     $assoc->setYear($this->_year);
                     $assoc->setCourseId($course->getId());
                     $assoc->setInstructorId($instr->getId());
                     $assoc->save($conn);
                 } else {
                     // TODO: big problem, duplicate assocs found
                     // log error and move on
                     continue;
                 }
             }
             // enrolled and responded
             if (isset($this->_infoArr[$i]["enrolled"])) {
                 $ratingObj = new AutoCourseRating();
                 $ratingObj->setFieldId(RatingFieldPeer::NUMBER_ENROLLED);
                 $ratingObj->setRating(0);
                 $ratingObj->setImportDt($dt);
                 $ratingObj->setNumber($this->_infoArr[$i]["enrolled"]);
                 $ratingObj->setCourseInsId($assoc->getId());
                 $ratingObj->save($conn);
             }
             if (isset($this->_infoArr[$i]["response"])) {
                 $ratingObj = new AutoCourseRating();
                 $ratingObj->setFieldId(RatingFieldPeer::NUMBER_RESPONDED);
                 $ratingObj->setRating(0);
                 $ratingObj->setImportDt($dt);
                 $ratingObj->setNumber($this->_infoArr[$i]["response"]);
                 $ratingObj->setCourseInsId($assoc->getId());
                 $ratingObj->save($conn);
             }
             // we can now save the real rating data
             $ratingArr = $this->_ratingArr[$i];
             foreach ($ratingArr as $fieldId => $data) {
                 foreach ($data as $rating => $number) {
                     $ratingObj = new AutoCourseRating();
                     $ratingObj->setFieldId($fieldId);
                     $ratingObj->setRating($rating);
                     $ratingObj->setNumber($number);
                     $ratingObj->setImportDt($dt);
                     $ratingObj->setCourseInsId($assoc->getId());
                     $ratingObj->save($conn);
                 }
             }
         }
     } else {
         throw new Exception("readCsv method has not been called.");
     }
 }
Exemplo n.º 20
0
<?php 
$i = 0;
foreach ($pager->getResults() as $test_applicant) {
    ++$i;
    ?>
"<?php 
    echo $i + ($pager->getPage() - 1) * $pager->getMaxPerPage();
    ?>
","<?php 
    echo $test_applicant->getCode();
    ?>
","<?php 
    echo $test_applicant->getName();
    ?>
","<?php 
    echo DepartmentPeer::retrieveByPK($test_applicant->getDepartment1())->toString();
    ?>
","<?php 
    echo ClassGroupPeer::retrieveByPK($test_applicant->getClassGroup1())->toString();
    ?>
","<?php 
    echo $test_applicant->getRegTestPeriod1() ? RegTestPeriodPeer::retrieveByPK($test_applicant->getRegTestPeriod1())->getRegPeriod()->getName() : '-';
    ?>
","<?php 
    if ($test_applicant->getApplicantType() == TestApplicant::STATUS_NEW) {
        echo __('Baru');
    } elseif ($test_applicant->getApplicantType() == TestApplicant::STATUS_TRANSFER) {
        echo __('Pindahan');
    } elseif ($test_applicant->getApplicantType() == TestApplicant::STATUS_EXTEND) {
        echo __('Lanjutan');
    }
Exemplo n.º 21
0
 public function executeShowMedical()
 {
     $employee_medical = EmployeeMedicalPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($employee_medical);
     $this->subtitle = $employee_medical->toString() . ' - id:' . $employee_medical->getId();
     $academic_calendar_id = $this->getRequestParameter('academic_calendar_id');
     $academic_calendar = AcademicCalendarPeer::retrieveByPK($academic_calendar_id);
     $this->forward404Unless($academic_calendar);
     $department_id = $this->getRequestParameter('department_id');
     $department = DepartmentPeer::retrieveByPK($department_id);
     $this->forward404Unless($department);
     $actions = array(array('name' => 'Kembali', 'url' => 'employee_report/lisMedical?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'black'));
     $this->actions = $actions;
     $this->employee_medical = $employee_medical;
     $actions2 = array(array('name' => '<span>Rekap Kepegawaian</span>', 'url' => 'employee_report/list', 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Mutasi Jabatan</span>', 'url' => 'employee_report/listJob?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Absensi Pegawai</span>', 'url' => 'employee_report/listAbsence?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Absen Per Pegawai</span>', 'url' => 'employee_report/listAbsenceEmployee?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Cuti Pegawai</span>', 'url' => 'employee_report/listLeave?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Izin Pegawai</span>', 'url' => 'employee_report/listPermit?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Pengobatan</span>', 'url' => 'employee_report/listMedical?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sun', 'type' => 'direct'));
     array_push($actions2, array('name' => '<span>Gaji Pegawai</span>', 'url' => 'employee_report/listSalary?academic_calendar_id=' . $academic_calendar->getId() . '&department_id=' . $department->getId(), 'color' => 'sky'));
     $this->actions2 = $actions2;
     $cd = new Criteria();
     $cd->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee_permit->getEmployeeId());
     $this->employee_detail = EmployeeDetailPeer::doSelectOne($cd);
     $this->academic_calendar = $academic_calendar;
     $this->department = $department;
 }
Exemplo n.º 22
0
    ?>
&nbsp;ISLAM AL-AZHAR 10 KEMBANGAN<br />
        TAHUN PELAJARAN 2011 / 2012
        <?php 
} elseif ($appl->getDepartment1() == 3) {
    ?>
        <?php 
    echo DepartmentPeer::retrieveByPK($appl->getDepartment1())->toString();
    ?>
&nbsp;ISLAM AL-AZHAR 8 KEMBANGAN<br />
        TAHUN PELAJARAN 2011 / 2012
		<?php 
} else {
    ?>
        <?php 
    echo DepartmentPeer::retrieveByPK($appl->getDepartment1())->toString();
    ?>
&nbsp;ISLAM AL-AZHAR 9 KEMBANGAN<br />
        TAHUN PELAJARAN 2011 / 2012
        <?php 
}
?>
        </td>
        </tr>
        <tr><td colspan="3"><hr noshade></td></tr>
        <tr>
        	<td width="25%" style="text-align:left;">No. Test</td>
            <td width="3%" style="text-align:center">:</td>
        	<td style="text-align:justify;"><?php 
echo $appl->getCode();
?>
Exemplo n.º 23
0
echo include_partial('global/listAsPDF', array('title' => '', 'subtitle' => ''));
use_helper('Number', 'myHelper');
$dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo');
$depts = $dept->getId();
?>
<center>
<table class="list_content" width="30%">
	<thead>
		<tr>
			<th align="center" style="vertical-align: middle; font-size: 12px;" height="40px">
				<?php 
echo __('Perpustakaan');
?>
<br><?php 
echo DepartmentPeer::retrieveByPK($depts)->getName();
?>
</th>
		</tr>
	</thead>
	<tbody>
		<tr class="list">
			<td align="center" style="font-size: 12px;">
			<?php 
$jumlah = substr_count($catalog->getCode(), "-");
$potong = explode("-", $catalog->getCode());
if ($jumlah == 1) {
    echo $potong[0] . '<br>' . $potong[1];
} elseif ($jumlah == 2) {
    echo $potong[0] . '<br>' . $potong[1] . '<br>' . $potong[2];
} elseif ($jumlah == 3) {
Exemplo n.º 24
0
 public function save($param)
 {
     $department_id = $param['department_id'];
     $departmentAvailable = $this->tools->departmentAvailable($department_id);
     $item = new WebItem();
     if (empty($param['section'])) {
         $this->jsonwrapper->show_json_error('section', 'Kolom section harap diisi.');
     }
     $itemSection = DepartmentPeer::retrieveByPK($param['section']);
     if (!$itemSection) {
         $this->jsonwrapper->show_json_error('type', 'Section yang anda masukkan tidak ditemukan.');
     }
     if (!in_array($param['section'], $departmentAvailable)) {
         $this->jsonwrapper->show_json_error('forbidden', 'Maaf, anda tidak dapat membuat news dalam section ini.');
     }
     if (empty($param['category_id'])) {
         $this->jsonwrapper->show_json_error('category', 'Kolom category harap diisi.');
     }
     $itemCategory = WebItemCategoryPeer::retrieveByPK($param['category_id']);
     if (!$itemCategory) {
         $this->jsonwrapper->show_json_error('category', 'News Category yang anda masukkan tidak ditemukan.');
     }
     if (empty($param['date'])) {
         $this->jsonwrapper->show_json_error('date', 'Kolom created harap diisi.');
     }
     if (empty($param['hour'])) {
         $param['hour'] = 0;
     }
     if (empty($param['minute'])) {
         $param['minute'] = 0;
     }
     $newDate = $param['date'] . ' ' . $param['hour'] . ':' . $param['minute'] . ':00';
     $newDate = date('Y-m-d H:i:s', strtotime($newDate));
     if (empty($param['title'])) {
         $this->jsonwrapper->show_json_error('title', 'Kolom title harap diisi.');
     }
     if (empty($param['initial'])) {
         $this->jsonwrapper->show_json_error('initial', 'Kolom initial harap diisi.');
     }
     if (empty($param['image'])) {
         /*	$this->jsonwrapper->show_json_error('image', 'Kolom image harap diisi.'); */
         $param['image'] = '';
     }
     if (empty($param['description'])) {
         $this->jsonwrapper->show_json_error('description', 'Kolom description harap diisi.');
     }
     if (!empty($param['id'])) {
         $item = WebItemPeer::retrieveByPK($param['id']);
         if (!$item) {
             $this->jsonwrapper->show_json_error('id', 'News tidak ditemukan.');
         }
         if (!in_array($item->getDepartmentId(), $departmentAvailable)) {
             $this->jsonwrapper->show_json_error('forbidden', 'Maaf, anda tidak dapat mengedit news ini.');
         }
     } else {
         $item->setPublished(0);
         $item->setCreated(date('Y-m-d H:i:s'));
     }
     /* Add */
     $item->setTitle($param['title']);
     $item->setInitial($param['initial']);
     $item->setImage($param['image']);
     $item->setDepartmentId($param['section']);
     $item->setItemCategoryId($param['category_id']);
     $item->setDescription($param['description']);
     $item->setCreated($newDate);
     if (!$item->validate()) {
         var_dump($item->validate());
     }
     $item->save();
     $output = array('success' => 1, 'data' => $param);
     $this->jsonwrapper->print_json($output);
 }
Exemplo n.º 25
0
 public function getDepartmentRelatedByDepartment2($con = null)
 {
     include_once 'lib/model/om/BaseDepartmentPeer.php';
     if ($this->aDepartmentRelatedByDepartment2 === null && $this->department_2 !== null) {
         $this->aDepartmentRelatedByDepartment2 = DepartmentPeer::retrieveByPK($this->department_2, $con);
     }
     return $this->aDepartmentRelatedByDepartment2;
 }
Exemplo n.º 26
0
 public function executeEnquiryProcess()
 {
     /* Initialize */
     $this->getEnquirer();
     $valid = true;
     $error_message = array();
     $now = date('Y-m-d H:i:s');
     /* Filter User */
     if (!$this->filterUser(true)) {
         $this->jsonwrapper->print_json(array('success' => false, 'code' => 'security', 'message' => 'You must login to access this url.'));
     }
     /* Get All Parameter */
     $param = $this->getAllRequestParameter();
     /* enquiry_name */
     if (empty($param['enquirer_name'])) {
         $error_message[] = array('field' => 'enquirer_name', 'message' => 'Please enter your enquirer name');
         $valid = false;
     }
     /* enquiry_type */
     if (empty($param['enquiry_type'])) {
         $error_message[] = array('field' => 'enquiry_type', 'message' => 'Please enter enquiry type');
         $valid = false;
     } else {
         /* Check enquiry type exist or not */
         switch ($param['enquiry_type']) {
             case TestApplicant::ENQ_PHONE:
             case TestApplicant::ENQ_FAX:
             case TestApplicant::ENQ_EMAIL:
             case TestApplicant::ENQ_DIRECT:
                 break;
             default:
                 $error_message[] = array('field' => 'enquiry_type', 'message' => 'Enquiry type does not exist');
                 $valid = false;
                 break;
         }
     }
     /* enquiry_getinformation */
     if (empty($param['getinformation'])) {
         $error_message[] = array('field' => 'getinformation', 'message' => 'Please enter this field');
         $valid = false;
     } else {
         switch ($param['getinformation']) {
             case TestApplicant::REG_INFO_FAM:
             case TestApplicant::REG_INFO_NEWSP:
             case TestApplicant::REG_INFO_SCH:
             case TestApplicant::REG_INFO_BAN:
             case TestApplicant::REG_INFO_MISC:
                 break;
             default:
                 $error_message[] = array('field' => 'getinformation', 'message' => 'Information type does not exist');
                 $valid = false;
                 break;
         }
     }
     /* enquiry comment */
     if (empty($param['comment'])) {
         $error_message[] = array('field' => 'comment', 'message' => 'Please enter a comment');
         $valid = false;
     }
     /* --- Applicant --- */
     /* applicant name */
     if (empty($param['applicant_name'])) {
         $error_message[] = array('field' => 'applicant_name', 'message' => 'Please enter your Applicant Fullname');
         $valid = false;
     }
     /* Relationship */
     if (empty($param['relationship'])) {
         $error_message[] = array('field' => 'relationship', 'message' => 'Please enter your relation with applicant');
         $valid = false;
     }
     /* Address */
     if (empty($param['address'])) {
         $error_message[] = array('field' => 'address', 'message' => 'Please enter applicant address');
         $valid = false;
     }
     /* POB */
     if (empty($param['pob'])) {
         $error_message[] = array('field' => 'pob', 'message' => 'Please enter applicant place of birth');
         $valid = false;
     }
     /* DOB */
     if (empty($param['dob'])) {
         $error_message[] = array('field' => 'dob', 'message' => 'Please enter applicant date of birth');
         $valid = false;
     }
     /* present school */
     if (empty($param['present_school'])) {
         $error_message[] = array('field' => 'present_school', 'message' => 'Please enter Applicant Present School');
         $valid = false;
     }
     /* present level */
     if (empty($param['present_level'])) {
         $error_message[] = array('field' => 'present_level', 'message' => 'Please enter Applicant Present Level');
         $valid = false;
     }
     /* school_interested */
     if (empty($param['school_interested'])) {
         $error_message[] = array('field' => 'school_interested', 'message' => 'Please enter Applicant School Interested');
         $valid = false;
     } else {
         /* Check School Interested Exist or Not */
         $department = DepartmentPeer::retrieveByPK($param['school_interested']);
         if (!$department) {
             $error_message[] = array('field' => 'school_interested', 'message' => 'Shool Interested you entered is not valid');
             $valid = false;
         } else {
             if ($department->getParent() == 0) {
                 $error_message[] = array('field' => 'school_interested', 'message' => 'Shool Interested you entered is not valid');
                 $valid = false;
             } else {
                 /* level_interested */
                 if (empty($param['level_interested'])) {
                     $error_message[] = array('field' => 'level_interested', 'message' => 'Please enter Applicant Level Interested');
                     $valid = false;
                 } else {
                     /* Check class exist or not */
                     $classCriteria = new Criteria();
                     $classCriteria->add(VClassGroupPeer::DEPARTMENT_ID, $department->getId(), Criteria::EQUAL);
                     $classCriteria->add(VCLassGroupPeer::ID, $param['level_interested'], Criteria::EQUAL);
                     $classInterested = VCLassGroupPeer::doSelectOne($classCriteria);
                     if (!$classInterested) {
                         $error_message[] = array('field' => 'level_interested', 'message' => 'Level Interested you entered is not valid');
                         $valid = false;
                     }
                 }
             }
         }
     }
     /* Check all parameter valid or not */
     if (!$valid) {
         $this->jsonwrapper->print_json(array('success' => false, 'code' => 'notvalid', 'error' => $error_message));
     }
     /* Start Transaction */
     $connection = Propel::getConnection('propel');
     $connection->begin();
     /* TABLE TEST_APPLICANT_ENQUIRER */
     $this->user->setFullname($param['enquirer_name']);
     $this->user->setEnquiryType($param['enquiry_type']);
     $this->user->setComments($param['comment']);
     /* Try Save */
     try {
         $this->user->save();
     } catch (Exception $e) {
         $connection->rollback();
         $this->jsonwrapper->print_json(array('success' => false, 'code' => 'fail', 'message' => 'Error while save the data, please try again later.', 'message2' => 'Error save enquirer - process1'));
     }
     /* TABLE TEST_APPLICANT */
     /* Get this applicant, if empty then create a new one */
     $applicant = $this->pmbTools->getApplicant($this->user);
     if (!$applicant) {
         $applicant = new TestApplicant();
         $newApplicant = true;
     } else {
         $newApplicant = false;
     }
     /* If New Applicant */
     /* This field cannot be changed */
     if ($newApplicant) {
         $applicantCode = $this->pmbTools->generateApplicantCode(StudentDetail::BUY);
         $applicant->setStatus(StudentDetail::BUY);
         $applicant->setCode($this->pmbTools->generateApplicantCode(StudentDetail::BUY));
         $applicant->setEnrolled(0);
         $applicant->setApplicantType(TestApplicant::STATUS_NEW);
     }
     /* Field can be changed */
     $applicant->setName($param['applicant_name']);
     $applicant->setTestApplicantEnquirerId($this->user->getId());
     $applicant->setEnquirerRelation($param['relationship']);
     $applicant->setRegInfo($param['getinformation']);
     $applicant->setYear(date('Y', strtotime($now)));
     $applicant->setDepartment1($department->getId());
     $applicant->setClassGroup1($classInterested->getId());
     /* Try save applicant */
     try {
         $applicant->save();
     } catch (Exception $e) {
         $connection->rollback();
         $this->jsonwrapper->print_json(array('success' => false, 'code' => 'fail', 'message' => 'Error while save the data, please try again later.', 'message2' => 'Error save applicant - process2'));
     }
     /* TABLE APPLICANT_DETAIL */
     if ($applicant->getTestApplicantDetail()) {
         $applicantDetail = $applicant->getTestApplicantDetail();
         $newApplicantDetail = false;
     } else {
         $applicantDetail = new TestApplicantDetail();
         $newApplicantDetail = true;
     }
     /* Fill Applicant Detail */
     $applicantDetail->setAddress($param['address']);
     $applicantDetail->setPob($param['pob']);
     $applicantDetail->setDob(date('Y-m-d', strtotime($param['dob'])));
     $applicantDetail->setSchoolOfOrigin($param['present_school']);
     $applicantDetail->setClassOfOrigin($param['present_level']);
     /* Try save applicant_detail */
     try {
         $applicantDetail->save();
     } catch (Exception $e) {
         $connection->rollback();
         $this->jsonwrapper->print_json(array('success' => false, 'code' => 'fail', 'message' => 'Error while save the data, please try again later.', 'message2' => 'Error save applicant_detail - process3'));
     }
     if ($newApplicantDetail) {
         /* Create relation between applicant and applicant_detail */
         $applicant->setTestApplicantDetailId($applicantDetail->getId());
         try {
             $applicant->save();
         } catch (Exception $e) {
             $connection->rollback();
             $this->jsonwrapper->print_json(array('success' => false, 'code' => 'fail', 'message' => 'Error while save the data, please try again later.', 'message2' => 'Error create relation between applicant and applicant_detail - process3.1'));
         }
     }
     $connection->commit();
     $this->jsonwrapper->print_json(array('success' => true, 'code' => 'success', 'message' => 'Data successfully saved', 'href' => $this->pmbTools->pmbUrl('account/index')));
 }
Exemplo n.º 27
0
     $item = WebSlideshowPeer::doSelectOne($itemCriteria);
     if (!$item) {
         $this->jsonwrapper->show_json_error('not found', 'Image item tidak ditemukan.');
     }
     $output = array('success' => 1, 'data' => $item->toArray());
     $this->jsonwrapper->print_json($output);
 }
 public function categorysave($param)
 {
     $department_id = $param['department_id'];
     $departmentAvailable = $this->tools->departmentAvailable($department_id);
     $category = new WebImageCategory();
     if (empty($param['section'])) {
         $this->jsonwrapper->show_json_error('section', 'Kolom section harap diisi.');
     }
     $itemSection = DepartmentPeer::retrieveByPK($param['section']);
     if (!$itemSection) {
         $this->jsonwrapper->show_json_error('section', 'Section tidak ditemukan.');
     }
     if (!in_array($param['section'], $departmentAvailable)) {
         $this->jsonwrapper->show_json_error('forbidden', 'Maaf, anda tidak dapat membuat image item di section ini.');
     }
     if (empty($param['name'])) {
         $this->jsonwrapper->show_json_error('name', 'Kolom nama harap diisi.');
     }
     if (empty($param['initial'])) {
         $this->jsonwrapper->show_json_error('initial', 'Kolom initial harap diisi.');
     }
     if (!empty($param['id'])) {
         $category = WebImageCategoryPeer::retrieveByPK($param['id']);
         if (!$category) {
             $this->jsonwrapper->show_json_error('id', 'Category tidak ditemukan.');
         }
         if (!in_array($category->getDepartmentId(), $departmentAvailable)) {
             $this->jsonwrapper->show_json_error('forbidden', 'Maaf, anda tidak dapat mengedit category ini.');
         }
     } else {
         $category->setPublished(0);
         $category->setCreated(date('Y-m-d H:i:s'));
     }
     /* Add */
     $category->setName($param['name']);
     $category->setInitial($param['initial']);
     $category->setDepartmentId($param['section']);
Exemplo n.º 28
0
 public function getDepartment($con = null)
 {
     include_once 'lib/model/om/BaseDepartmentPeer.php';
     if ($this->aDepartment === null && $this->department_id !== null) {
         $this->aDepartment = DepartmentPeer::retrieveByPK($this->department_id, $con);
     }
     return $this->aDepartment;
 }
Exemplo n.º 29
0
            body { margin: 30px; margin-top: 10px; }
            body * { font-size: 12px;  font-family: Times New Roman; }
            p.header, p.subheader, p.bigheader { margin: 0; margin-left: 5px; margin-right: 10px; padding: 0; font-family: corpidoffice;}
            p.header { font-size: 12px; font-weight: bold; color: black; }
            p.bigheader { font-size: 16px; font-weight: bold; color: black; }
            p.subheader { font-size: 10px; }
            table.list_content { border-collapse: collapse; width: auto; margin: auto; margin-top: 20px; }
            table.list_content td, table.list_content th { border: 1px solid black; padding: 2px 4px; vertical-align: top; }
            .list_content th { font-style: italic; background-color: #DAF383; text-align: left; }
            .even td { background-color: #F4F4F2; }
            .pager_top { width: 100%; text-align: left; }
            .pager_record, .pager_page { display: none; }
            td.list { text-align: center; }
    </style>
            <?php 
$dept = DepartmentPeer::retrieveByPK($department_id);
$c = new Criteria();
$c->add(DepartmentDetailPeer::DEPARTMENT_ID, $dept->getId());
$department_detail = DepartmentDetailPeer::doSelectOne($c);
?>
            <table width="100%" style="left: -20px;">   
            <tr><td align="right">
            
                    <table style="padding:0; border-collapse:collapse;" width="100%">			
                    <tr>
                            <td align="left" width="100%">
                                        <table border="0" width="100%">
                                                <tr>
                                                        <td align="right" width="15%" style="vertical-align: middle;">
                                                                <img  src='<?php 
echo image_path('logo_' . $dept->getNumCode() . '.jpg', true);