Ejemplo n.º 1
0
 public static function getShowData($data)
 {
     $data["subject"] = stripslashes($data["subject"]);
     if (!empty($data["author"])) {
         $data["authorDeptName"] = Department::model()->fetchDeptNameByUid($data["author"]);
     }
     if ($data["approver"] != 0) {
         $data["approver"] = User::model()->fetchRealNameByUid($data["approver"]);
     } else {
         $data["approver"] = Ibos::lang("None");
     }
     $data["addtime"] = ConvertUtil::formatDate($data["addtime"], "u");
     $data["uptime"] = empty($data["uptime"]) ? "" : ConvertUtil::formatDate($data["uptime"], "u");
     $data["categoryName"] = ArticleCategory::model()->fetchCateNameByCatid($data["catid"]);
     if (empty($data["deptid"]) && empty($data["positionid"]) && empty($data["uid"])) {
         $data["departmentNames"] = Ibos::lang("All");
         $data["positionNames"] = $data["uidNames"] = "";
     } elseif ($data["deptid"] == "alldept") {
         $data["departmentNames"] = Ibos::lang("All");
         $data["positionNames"] = $data["uidNames"] = "";
     } else {
         $department = DepartmentUtil::loadDepartment();
         $data["departmentNames"] = ArticleUtil::joinStringByArray($data["deptid"], $department, "deptname", "、");
         $position = PositionUtil::loadPosition();
         $data["positionNames"] = ArticleUtil::joinStringByArray($data["positionid"], $position, "posname", "、");
         if (!empty($data["uid"])) {
             $users = User::model()->fetchAllByUids(explode(",", $data["uid"]));
             $data["uidNames"] = ArticleUtil::joinStringByArray($data["uid"], $users, "realname", "、");
         } else {
             $data["uidNames"] = "";
         }
     }
     return $data;
 }
Ejemplo n.º 2
0
 public static function processShowData($resumeDetail)
 {
     $position = PositionUtil::loadPosition();
     $resumeDetail["targetposition"] = isset($position[$resumeDetail["positionid"]]) ? $position[$resumeDetail["positionid"]]["posname"] : "";
     $resumeDetail["age"] = self::handleAge($resumeDetail["birthday"]);
     $resumeDetail["gender"] = self::handleGender($resumeDetail["gender"]);
     $resumeDetail["workyears"] = self::handleWorkyears($resumeDetail["workyears"]);
     $resumeDetail["education"] = self::handleEdu($resumeDetail["education"]);
     $resumeDetail["maritalstatus"] = self::handleMaritalstatus($resumeDetail["maritalstatus"]);
     $resumeDetail["status"] = Resume::model()->fetchStatusByResumeid($resumeDetail["resumeid"]);
     return $resumeDetail;
 }
Ejemplo n.º 3
0
 public function fetchPosNameByPosId($id, $glue = ",", $returnFirst = false)
 {
     $posArr = PositionUtil::loadPosition();
     $posIds = is_array($id) ? $id : explode(",", StringUtil::filterStr($id));
     $name = array();
     if ($returnFirst) {
         if (isset($posArr[$posIds[0]])) {
             $name[] = $posArr[$posIds[0]]["posname"];
         }
     } else {
         foreach ($posIds as $posId) {
             $name[] = isset($posArr[$posId]) ? $posArr[$posId]["posname"] : null;
         }
     }
     return implode($glue, $name);
 }
Ejemplo n.º 4
0
 private static function createStaticJs()
 {
     CacheUtil::load(array("department", "position"), true);
     $unit = Ibos::app()->setting->get("setting/unit");
     $department = DepartmentUtil::loadDepartment();
     $users = UserUtil::loadUser();
     $position = PositionUtil::loadPosition();
     $positionCategory = PositionUtil::loadPositionCategory();
     $companyData = self::initCompany($unit);
     $deptData = self::initDept($department);
     $userData = self::initUser($users);
     $posData = self::initPosition($position);
     $posCatData = self::initPositionCategory($positionCategory);
     $default = file_get_contents(PATH_ROOT . "/static/js/src/org.default.js");
     if ($default) {
         $patterns = array("/\\{\\{(company)\\}\\}/", "/\\{\\{(department)\\}\\}/", "/\\{\\{(position)\\}\\}/", "/\\{\\{(users)\\}\\}/", "/\\{\\{(positioncategory)\\}\\}/");
         $replacements = array($companyData, $deptData, $posData, $userData, $posCatData);
         $new = preg_replace($patterns, $replacements, $default);
         FileUtil::createFile("data/org.js", $new);
         CacheUtil::update("setting");
     }
 }
Ejemplo n.º 5
0
								<th><?php 
    echo $lang['Position'];
    ?>
</th>
								<th width="60"><?php 
    echo $lang['Operation'];
    ?>
</th>
							</tr>
						</thead>
						<tbody>
							<?php 
    $dept = DepartmentUtil::loadDepartment();
    ?>
							<?php 
    $position = PositionUtil::loadPosition();
    ?>
							<?php 
    foreach ($list as $key => $value) {
        ?>
								<tr>
									<td>
										<?php 
        if ($value['uid'] !== '1' && $value['perManager']) {
            ?>
											<label class="checkbox">
												<input type="checkbox" name="user" value="<?php 
            echo $value['uid'];
            ?>
" />
											</label>
Ejemplo n.º 6
0
 public static function getUserPurv($uid)
 {
     static $users = array();
     if (!isset($users[$uid])) {
         $access = array();
         $user = User::model()->fetchByUid($uid);
         foreach (explode(",", $user["allposid"]) as $posId) {
             $access = array_merge($access, PositionUtil::getPurv($posId));
         }
         $users[$uid] = $access;
     }
     return $users[$uid];
 }
Ejemplo n.º 7
0
 public function getData($condition = "")
 {
     return PositionUtil::loadPositionCategory();
 }
Ejemplo n.º 8
0
 public function autoProcessor($item, $readOnly)
 {
     $field = $item["data-field"];
     $width = isset($item["data-width"]) ? $item["data-width"] : "200";
     $autoValue = "";
     $value = $this->getValue($item);
     $hourTime = date("H:i:s", TIMESTAMP);
     $date = date("Y-m-d");
     $time = $date . " " . $hourTime;
     $isTextAuto = substr($field, 0, 8) !== "sys_list";
     $lang = Ibos::getLangSource("workflow.default");
     if ($isTextAuto) {
         switch ($field) {
             case "sys_date":
                 $autoValue = $date;
                 break;
             case "sys_date_cn":
                 $autoValue = ConvertUtil::formatDate(TIMESTAMP, "Y" . $lang["Year"] . "m" . $lang["Month"] . "d" . $lang["Chinese day"]);
                 break;
             case "sys_date_cn_short1":
                 $autoValue = ConvertUtil::formatDate(TIMESTAMP, "Y" . $lang["Year"] . "m" . $lang["month"]);
                 break;
             case "sys_date_cn_short2":
                 $autoValue = ConvertUtil::formatDate(TIMESTAMP, "m" . $lang["Month"] . "d" . $lang["Chinese day"]);
                 break;
             case "sys_date_cn_short3":
                 $autoValue = ConvertUtil::formatDate(TIMESTAMP, "Y" . $lang["Year"]);
                 break;
             case "sys_date_cn_short4":
                 $autoValue = date("Y", TIMESTAMP);
                 break;
             case "sys_time":
                 $autoValue = $hourTime;
                 break;
             case "sys_datetime":
                 $autoValue = $time;
                 break;
             case "sys_week":
                 $autoValue = WfCommonUtil::getWeek();
                 break;
             case "sys_userid":
                 $autoValue = Ibos::app()->user->uid;
                 break;
             case "sys_realname":
                 $autoValue = Ibos::app()->user->realname;
                 break;
             case "sys_userpos":
                 $autoValue = Ibos::app()->user->posname;
                 break;
             case "sys_realname_date":
                 $autoValue = Ibos::app()->user->realname . " " . $date;
                 break;
             case "sys_realname_datetime":
                 $autoValue = Ibos::app()->user->realname . " " . $time;
                 break;
             case "sys_deptname":
                 $autoValue = Department::model()->fetchDeptNameByDeptId(Ibos::app()->user->alldeptid);
                 break;
             case "sys_deptname_short":
                 $autoValue = Ibos::app()->user->deptname;
                 break;
             case "sys_formname":
                 $autoValue = $this->form->formname;
                 break;
             case "sys_runname":
                 $autoValue = $this->inDebug ? "" : $this->run->name;
                 break;
             case "sys_rundate":
                 $autoValue = $this->inDebug ? "" : ConvertUtil::formatDate($this->run->begintime, "d");
                 break;
             case "sys_rundatetime":
                 $autoValue = $this->inDebug ? "" : ConvertUtil::formatDate($this->run->begintime);
                 break;
             case "sys_runid":
                 $autoValue = $this->inDebug ? "" : $this->run->runid;
                 break;
             case "sys_autonum":
                 $autoValue = $this->inApp ? $this->flow->autonum : "";
                 break;
             case "sys_ip":
                 $autoValue = EnvUtil::getClientIp();
                 break;
             case "sys_sql":
                 $sql = $item["data-src"];
                 $tempopt = array("uid" => Ibos::app()->user->uid, "deptid" => Ibos::app()->user->deptid, "positionid" => Ibos::app()->user->positionid, "runid" => $this->inDebug ? "" : $this->run->runid);
                 $autoValue = $this->execSysSql($sql, $tempopt, false);
                 break;
             case "sys_manager1":
                 $main = Ibos::app()->user->deptid;
                 $deptCache = DepartmentUtil::loadDepartment();
                 $managerID = $deptCache[$main]["manager"];
                 if ($managerID != 0) {
                     $autoValue = User::model()->fetchRealnameByUid($managerID);
                 }
                 break;
             case "sys_manager2":
                 $main = Ibos::app()->user->deptid;
                 $deptCache = DepartmentUtil::loadDepartment();
                 $upid = $deptCache[$main]["upid"];
                 if ($upid != 0) {
                     if ($deptCache[$upid]["manager"] != 0) {
                         $autoValue = User::model()->fetchRealnameByUid($deptCache[$upid]["manager"]);
                     }
                 }
                 break;
             case "sys_manager3":
                 $main = Ibos::app()->user->deptid;
                 $deptCache = DepartmentUtil::loadDepartment();
                 $dept_str = Department::model()->queryDept($main);
                 $temp = explode(",", $dept_str);
                 $count = count($temp);
                 $dept = $temp[$count - 2];
                 if ($deptCache[$dept]["manager"] != 0) {
                     $autoValue = User::model()->fetchRealnameByUid($deptCache[$dept]["manager"]);
                 }
                 break;
             default:
                 break;
         }
         if ($value == "" && !$readOnly || $this->flow->isFixed() && $readOnly && StringUtil::findIn($this->process->processitemauto, $item["data-title"]) && $this->rp->opflag) {
             $eleout = "\t\t\t\t<input type=\"text\" style=\"width:{$width} px;\" name=\"data_{$item["itemid"]}\" value=\"{$autoValue}\" title=\"{$item["data-title"]}\" />";
         } else {
             $eleout = "\t\t\t\t<input type=\"text\" style=\"width:{$width} px;\" name=\"data_{$item["itemid"]}\" value=\"{$value}\" title=\"{$item["data-title"]}\" />";
         }
         $hidden = isset($item["data-hide"]) ? $item["data-hide"] : "0";
         if ($hidden == "1") {
             $eleout = str_ireplace("type=\"text\"", "type=\"hidden\"", $eleout);
         }
         if (!$readOnly) {
             if ($this->inApp && $this->flow->isFixed() && StringUtil::findIn($this->process->processitemauto, $item["data-title"])) {
                 $readOnly = true;
             } else {
                 $eleout = str_ireplace("<input", "<input data-orig-value=\"{$autoValue}\" data-focus=\"restore\"", $eleout);
             }
         }
         if ($readOnly) {
             $this->setCommonReadOnly($item, $eleout, "input");
         }
     } else {
         $autoValue = "<option value=\"\"";
         if ($value == "") {
             $autoValue .= " selected";
         }
         $autoValue .= "></option>\n";
         switch ($field) {
             case "sys_list_dept":
                 $cache = DepartmentUtil::loadDepartment();
                 $str = StringUtil::getTree($cache, "<option value='\$deptid' \$selected>\$spacer\$deptname</option>", $value);
                 $autoValue .= $str;
                 break;
             case "sys_list_user":
                 foreach (UserUtil::loadUser() as $user) {
                     $selected = $value == $user["uid"] ? "selected" : "";
                     $autoValue .= "<option {$selected} value='" . $user["uid"] . "'>" . $user["realname"] . "</option>";
                 }
                 break;
             case "sys_list_pos":
                 foreach (PositionUtil::loadPosition() as $pos) {
                     $selected = $value == $pos["positionid"] ? "selected" : "";
                     $autoValue .= "<option {$selected} value='" . $pos["positionid"] . "'>" . $pos["posname"] . "</option>";
                 }
                 break;
             case "sys_list_prcsuser1":
                 $autoValue .= $this->getProcessUserList($this->flow->flowid, 0, $value);
                 break;
             case "sys_list_prcsuser2":
                 $autoValue .= $this->getProcessUserList($this->flow->flowid, $this->process->processid, $value, true);
                 break;
             case "sys_list_sql":
                 $sql = $item["data-src"];
                 $tempopt = array("uid" => Ibos::app()->user->uid, "deptid" => Ibos::app()->user->deptid, "positionid" => Ibos::app()->user->positionid, "runid" => $this->inDebug ? "" : $this->run->runid);
                 $autoValue = $this->execSysSql($sql, $tempopt);
                 $autoValue .= $this->arrayTolist($autoValue, $value);
                 break;
             case "sys_list_manager1":
                 $main = Ibos::app()->user->deptid;
                 $autoValue .= $this->getManagerList($main, $value);
                 break;
             case "sys_list_manager2":
                 $main = Ibos::app()->user->deptid;
                 $deptCache = DepartmentUtil::loadDepartment();
                 $upid = $deptCache[$main]["upid"];
                 if ($upid != 0) {
                     $autoValue .= $this->getManagerList($main, $value);
                 }
                 break;
             case "sys_list_manager3":
                 $main = Ibos::app()->user->deptid;
                 $deptCache = DepartmentUtil::loadDepartment();
                 $dept_str = Department::model()->queryDept($main);
                 $temp = explode(",", $dept_str);
                 $count = count($temp);
                 $dept = $temp[$count - 2];
                 $autoValue .= $this->getManagerList($dept, $value);
                 break;
         }
         $eleout = "\t\t\t\t\t<select title=\"{$item["data-title"]}\" name=\"data_{$item["itemid"]}\">\r\n\t\t\t\t\t{$autoValue}\r\n\t\t\t\t\t</select>";
         if ($readOnly) {
             $this->setCommonReadOnly($item, $eleout, "select");
         }
     }
     return $eleout;
 }
Ejemplo n.º 9
0
 public function actionDel()
 {
     if (Ibos::app()->request->getIsAjaxRequest()) {
         $id = EnvUtil::getRequest("id");
         $ids = explode(",", trim($id, ","));
         foreach ($ids as $positionId) {
             Position::model()->deleteByPk($positionId);
             Ibos::app()->authManager->removeAuthItem($positionId);
             PositionResponsibility::model()->deleteAll("`positionid` = :positionid", array(":positionid" => $positionId));
             PositionRelated::model()->deleteAll("positionid = :positionid", array(":positionid" => $positionId));
             NodeRelated::model()->deleteAll("positionid = :positionid", array(":positionid" => $positionId));
             $relatedIds = User::model()->fetchUidByPosId($positionId);
             if (!empty($relatedIds)) {
                 User::model()->updateByUids($relatedIds, array("positionid" => 0));
             }
             PositionUtil::cleanPurvCache($positionId);
         }
         OrgUtil::update();
         $this->ajaxReturn(array("IsSuccess" => true), "json");
     }
 }