Ejemplo n.º 1
0
 public function addLog($assignmentId, $type, $content)
 {
     $uid = Ibos::app()->user->uid;
     $realname = User::model()->fetchRealnameByUid($uid);
     $data = array("assignmentid" => $assignmentId, "uid" => $uid, "time" => TIMESTAMP, "ip" => EnvUtil::getClientIp(), "type" => $type, "content" => $realname . $content);
     return $this->add($data);
 }
Ejemplo n.º 2
0
 public function republicAll()
 {
     if (LOCAL) {
         $except = array("image", "css", "font", "js", ".", "..");
         $basePath = $this->getBasePath();
         $dir = @opendir($basePath);
         while ($entry = @readdir($dir)) {
             $file = $basePath . DIRECTORY_SEPARATOR . $entry;
             if (!in_array($entry, array_merge($this->excludeFiles, $except))) {
                 if (is_dir($file)) {
                     FileUtil::clearDirs($file . "/");
                 }
             }
         }
         closedir($dir);
         $modules = Ibos::app()->getEnabledModule();
         foreach ($modules as $module) {
             $path = Yii::getPathOfAlias("application.modules.{$module["module"]}.static");
             if (is_dir($path)) {
                 $this->publish($path, false, -1, true);
             }
         }
     }
     return true;
 }
Ejemplo n.º 3
0
 public function actionFileUp()
 {
     $config = array("savePath" => "data/editor/file/" . Ibos::app()->user->uid . "/", "allowFiles" => array(".rar", ".doc", ".docx", ".zip", ".pdf", ".txt", ".swf", ".wmv"), "maxSize" => 5000);
     $up = new EditorUploader("upfile", $config);
     $info = $up->getFileInfo();
     echo "{\"url\":\"" . $info["url"] . "\",\"fileType\":\"" . $info["type"] . "\",\"original\":\"" . $info["originalName"] . "\",\"state\":\"" . $info["state"] . "\"}";
 }
Ejemplo n.º 4
0
 public function renderIndex()
 {
     $return = array();
     $viewAlias = "application.modules.report.views.indexapi.report";
     $uid = Ibos::app()->user->uid;
     $reports = Report::model()->fetchAllRepByUids($uid);
     if (!empty($reports)) {
         $reports = $this->handleIconUrl($reports);
     }
     $subUidArr = User::model()->fetchSubUidByUid($uid);
     $subUidStr = implode(",", $subUidArr);
     $subReports = Report::model()->fetchAll("FIND_IN_SET(`uid`, '{$subUidStr}') OR FIND_IN_SET({$uid}, `toid`)");
     if (!empty($subReports)) {
         $subReports = $this->handleIconUrl($subReports, true);
     }
     $data = array("reports" => $reports, "subReports" => $subReports, "lang" => Ibos::getLangSource("report.default"), "assetUrl" => Yii::app()->assetManager->getAssetsUrl("report"));
     foreach ($this->_indexTab as $tab) {
         $data["tab"] = $tab;
         if ($tab == "reportPersonal") {
             $return[$tab] = Yii::app()->getController()->renderPartial($viewAlias, $data, true);
         } else {
             if ($tab == "reportAppraise" && (0 < count($subUidArr) || !empty($subReports))) {
                 $return[$tab] = Yii::app()->getController()->renderPartial($viewAlias, $data, true);
             }
         }
     }
     return $return;
 }
Ejemplo n.º 5
0
 private function getData()
 {
     $id = EnvUtil::getRequest("id");
     $aidString = base64_decode(rawurldecode($id));
     if (empty($aidString)) {
         $this->error(Ibos::lang("Parameters error", "error"), "", array("autoJump" => 0));
     }
     $salt = Ibos::app()->user->salt;
     $decodeString = StringUtil::authCode($aidString, "DECODE", $salt);
     $decodeArr = explode("|", $decodeString);
     $count = count($decodeArr);
     if ($count < 3) {
         $this->error(Ibos::lang("Data type invalid", "error"), "", array("autoJump" => 0));
     } else {
         $aid = $decodeArr[0];
         $tableId = $decodeArr[1];
         if (0 <= $tableId && $tableId < 10) {
             $attach = AttachmentN::model()->fetch($tableId, $aid);
         }
         $return = array("decodeArr" => $decodeArr, "attach" => array());
         if (!empty($attach)) {
             $return["attach"] = $attach;
         }
         return $return;
     }
 }
Ejemplo n.º 6
0
 public function actionDel()
 {
     if (Ibos::app()->request->isAjaxRequest) {
         $typeid = intval(EnvUtil::getRequest("typeid"));
         if (empty($typeid)) {
             $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("Parameters error", "error")));
         }
         $removeSuccess = ReportType::model()->remove($typeid);
         if ($removeSuccess) {
             $reports = Report::model()->fetchRepidAndAidByTypeids($typeid);
             if (!empty($reports)) {
                 if ($reports["aids"]) {
                     AttachUtil::delAttach($reports["aids"]);
                 }
                 ReportRecord::model()->deleteAll("repid IN('{$reports["repids"]}')");
                 Report::model()->deleteAll("repid IN('{$reports["repids"]}')");
             }
             $return["isSuccess"] = true;
             $return["msg"] = Ibos::lang("Del succeed", "message");
         } else {
             $return["isSuccess"] = false;
             $return["msg"] = Ibos::lang("Del failed", "message");
         }
         $this->ajaxReturn($return);
     }
 }
Ejemplo n.º 7
0
 public function run()
 {
     $attr = $this->getAttributes();
     $map = array("module" => $this->getModule(), "table" => $this->getTable(), "rowid" => $attr["rowid"], "isdel" => 0);
     $attr["count"] = Comment::model()->countByAttributes($map);
     $list = $this->getCommentList();
     $isAdministrator = Ibos::app()->user->isadministrator;
     $uid = Ibos::app()->user->uid;
     foreach ($list as &$cm) {
         $cm["isCommentDel"] = $isAdministrator || $uid === $cm["uid"];
         $cm["replys"] = intval(Comment::model()->countByAttributes(array("module" => "message", "table" => "comment", "rowid" => $cm["cid"], "isdel" => 0)));
     }
     $attr["comments"] = $list;
     $attr["lang"] = Ibos::getLangSources(array("message.default"));
     $content = $this->render($this->getParseView("comment"), $attr, true);
     $ajax = $attr["inAjax"];
     $count = $attr["count"];
     unset($attr);
     $return = array("isSuccess" => true, "data" => $content, "count" => $count);
     if ($ajax == 1) {
         $this->getOwner()->ajaxReturn($return);
     } else {
         echo $return["data"];
     }
 }
Ejemplo n.º 8
0
 private function loadTodo($num = 4)
 {
     $uid = Ibos::app()->user->uid;
     $fields = array("frp.runid", "frp.processid", "frp.flowprocess", "ft.type", "frp.flag", "ft.flowid", "fr.name as runName", "fr.beginuser", "fr.focususer");
     $condition = array("and", "fr.delflag = 0", "frp.childrun = 0", sprintf("frp.uid = %d", $uid));
     $condition[] = array("in", "frp.flag", array(1, 2));
     $sort = "frp.createtime DESC";
     $group = "frp.id";
     $runProcess = Ibos::app()->db->createCommand()->select($fields)->from("{{flow_run_process}} frp")->leftJoin("{{flow_run}} fr", "frp.runid = fr.runid")->leftJoin("{{flow_type}} ft", "fr.flowid = ft.flowid")->where($condition)->order($sort)->group($group)->offset(0)->limit($num)->queryAll();
     $allProcess = FlowProcess::model()->fetchAllProcessSortByFlowId();
     foreach ($runProcess as &$run) {
         $run["user"] = User::model()->fetchByUid($run["beginuser"]);
         if ($run["type"] == 1) {
             if (isset($allProcess[$run["flowid"]][$run["flowprocess"]]["name"])) {
                 $run["stepname"] = $allProcess[$run["flowid"]][$run["flowprocess"]]["name"];
             } else {
                 $run["stepname"] = Ibos::lang("Process steps already deleted", "workflow.default");
             }
         } else {
             $run["stepname"] = Ibos::lang("Step", "", array("{step}" => $run["processid"]));
         }
         $run["focus"] = StringUtil::findIn($uid, $run["focususer"]);
         $param = array("runid" => $run["runid"], "flowid" => $run["flowid"], "processid" => $run["processid"], "flowprocess" => $run["flowprocess"]);
         $run["key"] = WfCommonUtil::param($param);
     }
     return $runProcess;
 }
Ejemplo n.º 9
0
 protected function getIsNeedReset()
 {
     $neededReset = false;
     if ($this->account["expiration"] != 0) {
         if (Ibos::app()->user->lastchangepass == 0) {
             $neededReset = true;
         } else {
             $time = TIMESTAMP - Ibos::app()->user->lastchangepass;
             switch ($this->account["expiration"]) {
                 case "1":
                     if (30 < $time / 86400) {
                         $neededReset = true;
                     }
                     break;
                 case "2":
                     if (60 < $time / 86400) {
                         $neededReset = true;
                     }
                     break;
                 case "3":
                     if (180 < $time / 86400) {
                         $neededReset = true;
                     }
                     break;
                 default:
                     break;
             }
         }
     }
     return $neededReset;
 }
Ejemplo n.º 10
0
 public function getNews($id)
 {
     $gUid = Ibos::app()->user->uid;
     $article = Article::model()->fetchByPk($id);
     $attribute = ICArticle::getShowData($article);
     return $attribute;
 }
Ejemplo n.º 11
0
 public function actionIndex()
 {
     $op = EnvUtil::getRequest("op");
     $op = in_array($op, array("dept", "letter")) ? $op : "dept";
     $params = array();
     if ($op == "letter") {
         $params["datas"] = $this->getDataByLetter();
     } else {
         $params["datas"] = $this->getDataByDept();
     }
     $userDatas = array();
     if (!empty($params["datas"])) {
         foreach ($params["datas"] as $datas) {
             $userDatas = $op == "dept" ? array_merge($userDatas, $datas["users"]) : array_merge($userDatas, $datas);
         }
     }
     $params["uids"] = implode(",", ConvertUtil::getSubByKey($userDatas, "uid"));
     $uid = Ibos::app()->user->uid;
     $params["cuids"] = Contact::model()->fetchAllConstantByUid($uid);
     $this->setPageTitle(Ibos::lang("Contact"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Contact"), "url" => $this->createUrl("defalut/index")), array("name" => Ibos::lang("Company contact"))));
     $view = $op == "letter" ? "letter" : "dept";
     $params["allLetters"] = $this->allLetters;
     $this->render($view, $params);
 }
Ejemplo n.º 12
0
 private function loadNewArticle($num = 3)
 {
     $uid = Ibos::app()->user->uid;
     $allDeptId = Ibos::app()->user->alldeptid . "";
     $allPosId = Ibos::app()->user->allposid . "";
     $deptCondition = "";
     $deptIdArr = explode(",", $allDeptId);
     if (0 < count($deptIdArr)) {
         foreach ($deptIdArr as $deptId) {
             $deptCondition .= "FIND_IN_SET('{$deptId}',deptid) OR ";
         }
         $deptCondition = substr($deptCondition, 0, -4);
     } else {
         $deptCondition = "FIND_IN_SET('',deptid)";
     }
     $condition = " ( ((deptid='alldept' OR {$deptCondition} OR FIND_IN_SET('{$allPosId}',positionid) OR FIND_IN_SET('{$uid}',uid)) OR (deptid='' AND positionid='' AND uid='') OR (author='{$uid}') OR (approver='{$uid}')) ) AND `status`='1'";
     $criteria = array("select" => "articleid,subject,content,addtime,type", "condition" => $condition, "order" => "`istop` DESC, `addtime` DESC", "offset" => 0, "limit" => $num);
     $articles = Article::model()->fetchAll($criteria);
     if (!empty($articles)) {
         foreach ($articles as &$article) {
             $read = ArticleReader::model()->fetchByAttributes(array("articleid" => $article["articleid"], "uid" => $uid));
             $readStatus = $read ? 1 : 0;
             if ($readStatus) {
                 $article["iconStyle"] = $this->iconReadStyle[$article["type"]];
             } else {
                 $article["iconStyle"] = $this->iconNormalStyle[$article["type"]];
             }
         }
     }
     return $articles;
 }
Ejemplo n.º 13
0
 public static function checkVote($relatedModule, $relatedId, $uid = 0)
 {
     $result = false;
     $uid = empty($uid) ? Ibos::app()->user->uid : $uid;
     $condition = "relatedmodule=:relatedmodule AND relatedid=:relatedid";
     $params = array(":relatedmodule" => $relatedModule, ":relatedid" => $relatedId);
     $vote = Vote::model()->fetch($condition, $params);
     if (!empty($vote)) {
         $voteid = $vote["voteid"];
         $voteItemList = VoteItem::model()->fetchAll("voteid=:voteid", array(":voteid" => $voteid));
         foreach ($voteItemList as $voteItem) {
             $itemid = $voteItem["itemid"];
             $itemCountList = VoteItemCount::model()->fetchAll("itemid=:itemid", array(":itemid" => $itemid));
             if (!empty($itemCountList) && 0 < count($itemCountList)) {
                 foreach ($itemCountList as $itemCount) {
                     if ($itemCount["uid"] == $uid) {
                         $result = true;
                         break;
                     }
                 }
             }
         }
     }
     return $result;
 }
Ejemplo n.º 14
0
 public function actionIndex()
 {
     if (isset($_GET["pagesize"])) {
         $this->setListPageSize($_GET["pagesize"]);
     }
     $key = StringUtil::filterCleanHtml(EnvUtil::getRequest("keyword"));
     $fields = array("frp.runid", "frp.processid", "frp.flowprocess", "frp.flag", "frp.opflag", "frp.processtime", "ft.freeother", "ft.flowid", "ft.name as typeName", "ft.type", "ft.listfieldstr", "fr.name as runName", "fr.beginuser", "fr.begintime", "fr.endtime", "fr.focususer");
     $sort = "frp.processtime";
     $group = "frp.runid";
     $condition = array("and", "fr.delflag = 0", "frp.childrun = 0", sprintf("frp.uid = %d", $this->uid), sprintf("FIND_IN_SET(fr.focususer,'%s')", $this->uid));
     if ($key) {
         $condition[] = array("like", "fr.runid", "%{$key}%");
         $condition[] = array("or like", "fr.name", "%{$key}%");
     }
     $count = Ibos::app()->db->createCommand()->select("count(*) as count")->from("{{flow_run_process}} frp")->leftJoin("{{flow_run}} fr", "frp.runid = fr.runid")->leftJoin("{{flow_type}} ft", "fr.flowid = ft.flowid")->where($condition)->group($group)->queryScalar();
     $pages = PageUtil::create($count, $this->getListPageSize());
     if ($key && $count) {
         $pages->params = array("keyword" => $key);
     }
     $offset = $pages->getOffset();
     $limit = $pages->getLimit();
     $list = Ibos::app()->db->createCommand()->select($fields)->from("{{flow_run_process}} frp")->leftJoin("{{flow_run}} fr", "frp.runid = fr.runid")->leftJoin("{{flow_type}} ft", "fr.flowid = ft.flowid")->where($condition)->order($sort)->group($group)->offset($offset)->limit($limit)->queryAll();
     $data = array_merge(array("pages" => $pages), $this->handleList($list));
     $this->setPageTitle(Ibos::lang("My focus"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Workflow")), array("name" => Ibos::lang(Ibos::lang("My focus")), "url" => $this->createUrl("focus/index")), array("name" => Ibos::lang("List"))));
     $this->render("index", $data);
 }
Ejemplo n.º 15
0
 public static function update($cacheName = "")
 {
     $updateList = empty($cacheName) ? array() : (is_array($cacheName) ? $cacheName : array($cacheName));
     if (!$updateList) {
         $cacheDir = Ibos::getPathOfAlias(self::CACHE_ALIAS);
         $cacheDirHandle = dir($cacheDir);
         while ($entry = $cacheDirHandle->read()) {
             $isProviderFile = preg_match("/^([\\_\\w]+)CacheProvider\\.php\$/", $entry, $matches) && substr($entry, -4) == ".php" && is_file($cacheDir . "/" . $entry);
             if (!in_array($entry, array(".", "..")) && $isProviderFile) {
                 $class = basename($matches[0], ".php");
                 if (class_exists($class)) {
                     Ibos::app()->attachBehavior("onUpdateCache", array("class" => self::CACHE_ALIAS . "." . $class));
                 }
             }
         }
     } else {
         foreach ($updateList as $entry) {
             $owner = ucfirst($entry) . "CacheProvider";
             if (class_exists($owner)) {
                 Ibos::app()->attachBehavior("onUpdateCache", array("class" => self::CACHE_ALIAS . "." . $owner));
             }
         }
     }
     if (Ibos::app()->hasEventHandler("onUpdateCache")) {
         Ibos::app()->raiseEvent("onUpdateCache", new CEvent(Ibos::app()));
     }
 }
Ejemplo n.º 16
0
 public function actionIndex()
 {
     $types = EnvUtil::getRequest("updatetype");
     $data = array();
     if (EnvUtil::submitCheck("formhash")) {
         $type = implode(",", $types);
         if (!empty($type)) {
             $this->redirect($this->createUrl("update/index", array("doupdate" => 1, "updatetype" => $type)));
         }
     }
     if (Ibos::app()->request->getIsAjaxRequest()) {
         $op = EnvUtil::getRequest("op");
         if (LOCAL) {
             @set_time_limit(0);
         }
         if ($op == "data") {
             CacheUtil::update();
         }
         if ($op == "static") {
             LOCAL && Ibos::app()->assetManager->republicAll();
             OrgUtil::update();
         }
         if ($op == "module") {
             ModuleUtil::updateConfig();
         }
         Ibos::app()->cache->clear();
         $this->ajaxReturn(array("isSuccess" => true));
     }
     if (EnvUtil::getRequest("doupdate") == 1) {
         $type = explode(",", trim($types, ","));
         $data["doUpdate"] = true;
         foreach ($type as $index => $act) {
             if (!empty($act)) {
                 if (in_array("data", $type)) {
                     unset($type[$index]);
                     $data["typedesc"] = Ibos::lang("Update") . Ibos::lang("Data cache");
                     $data["op"] = "data";
                     break;
                 }
                 if (in_array("static", $type)) {
                     unset($type[$index]);
                     $data["typedesc"] = Ibos::lang("Update") . Ibos::lang("Static cache");
                     $data["op"] = "static";
                     break;
                 }
                 if (in_array("module", $type)) {
                     $data["typedesc"] = Ibos::lang("Update") . Ibos::lang("Module setting");
                     $data["op"] = "module";
                     unset($type[$index]);
                     break;
                 }
             }
         }
         $data["next"] = $this->createUrl("update/index", array("doupdate" => intval(!empty($type)), "updatetype" => implode(",", $type)));
     } else {
         $data["doUpdate"] = false;
     }
     $this->render("index", $data);
 }
Ejemplo n.º 17
0
 public function setInit($moduleName)
 {
     $installedModule = Ibos::app()->getEnabledModule();
     if (isset($installedModule[$moduleName])) {
         Yii::app()->getModule($moduleName);
         $this->_init = true;
     }
 }
Ejemplo n.º 18
0
 public function getMail($id)
 {
     $gUid = Ibos::app()->user->uid;
     $email = new ICEmail($id);
     $bodyAttr = $email->emailBody->attributes;
     $bodyAttr = EmailUtil::processViewData($bodyAttr);
     return $bodyAttr;
 }
Ejemplo n.º 19
0
 public function actionUnFollow()
 {
     if (EnvUtil::submitCheck("formhash")) {
         $fid = StringUtil::filterCleanHtml($_POST["fid"]);
         $res = Follow::model()->unFollow(Ibos::app()->user->uid, intval($fid));
         $this->ajaxReturn(array("isSuccess" => !!$res, "msg" => Follow::model()->getError("unFollow")));
     }
 }
Ejemplo n.º 20
0
 public static function getLangSource($file)
 {
     static $langs = array();
     if (!isset($langs[$file])) {
         $langs[$file] = Ibos::app()->getMessages()->loadMessages($file, Ibos::app()->getLanguage());
     }
     return (array) $langs[$file];
 }
Ejemplo n.º 21
0
 public function increase($clid, $logArr)
 {
     if ($clid && !empty($logArr) && is_array($logArr)) {
         $sqlText = "UPDATE %s SET %s WHERE clid=%d";
         return Ibos::app()->db->createCommand()->setText(sprintf($sqlText, $this->tableName(), implode(",", $logArr), $clid))->execute();
     }
     return 0;
 }
Ejemplo n.º 22
0
 public function actionDel()
 {
     if (Ibos::app()->request->isAjaxRequest) {
         $id = intval(EnvUtil::getRequest("id"));
         MenuCommon::model()->deleteByPk($id);
         $this->ajaxReturn(array("isSuccess" => true));
     }
 }
Ejemplo n.º 23
0
 public function actionSetAllRead()
 {
     if (Ibos::app()->request->isAjaxRequest) {
         $uid = Yii::app()->user->uid;
         $res = NotifyMessage::model()->setRead($uid);
         $this->ajaxReturn(array("IsSuccess" => !!$res));
     }
 }
Ejemplo n.º 24
0
 public function actionGetRealname()
 {
     if (Ibos::app()->request->isAjaxRequest) {
         $keyword = EnvUtil::getRequest("keyword");
         $records = ResumeDetail::model()->fetchPKAndRealnameByKeyword($keyword);
         parent::ajaxReturn($records);
     }
 }
Ejemplo n.º 25
0
 private function getUnreadCount()
 {
     $unreadCount = UserData::model()->getUnreadCount(Ibos::app()->user->uid);
     $sidebarUnreadMap["mention"] = $unreadCount["unread_atme"];
     $sidebarUnreadMap["comment"] = $unreadCount["unread_comment"];
     $sidebarUnreadMap["notify"] = $unreadCount["unread_notify"];
     $sidebarUnreadMap["pm"] = $unreadCount["unread_message"];
     return $sidebarUnreadMap;
 }
Ejemplo n.º 26
0
 protected function getSidebar($catid = 0)
 {
     $sidebarAlias = "application.modules.officialdoc.views.sidebar";
     $approvals = Approval::model()->fetchAllApproval();
     $params = array("approvals" => $approvals, "categoryData" => $this->getCategoryOption(), "catid" => $catid);
     $noSignCount = Officialdoc::model()->countNoSignByUid(Ibos::app()->user->uid);
     $params["noSignCount"] = $noSignCount;
     return $this->renderPartial($sidebarAlias, $params, true);
 }
Ejemplo n.º 27
0
 public static function getLogTableId()
 {
     $tableId = CacheUtil::get("logtableid");
     if ($tableId === false) {
         $tableId = Ibos::app()->db->createCommand()->select("svalue")->from("{{setting}}")->where("skey = 'logtableid'")->queryScalar();
         CacheUtil::set("logtableid", intval($tableId));
     }
     return $tableId;
 }
Ejemplo n.º 28
0
 public static function getPurv($posId)
 {
     $access = CacheUtil::get("purv_" . $posId);
     if (!$access) {
         $access = Ibos::app()->getAuthManager()->getItemChildren($posId);
         CacheUtil::set("purv_" . $posId, array_flip(array_map("strtolower", array_keys($access))));
     }
     return $access;
 }
Ejemplo n.º 29
0
 public function run()
 {
     $factory = new ICChartFactory();
     $properties = array("uid" => $this->getUid(), "typeid" => $this->getTypeid(), "timeScope" => $this->getTimeScope());
     $scoreCounter = $this->createComponent("ICReportScoreTimeCounter", $properties);
     $stampCounter = $this->createComponent("ICReportStampCounter", $properties);
     $data = array("statAssetUrl" => Ibos::app()->assetManager->getAssetsUrl("statistics"), "score" => $factory->createChart($scoreCounter, "ICReportLineChart"), "stamp" => $factory->createChart($stampCounter, "ICReportBarChart"));
     $this->render(self::VIEW, $data);
 }
Ejemplo n.º 30
0
 public function init()
 {
     $this->setUid(intval(Ibos::app()->user->uid));
     $pageSize = filter_input(INPUT_GET, "pagesize", FILTER_SANITIZE_NUMBER_INT);
     if (!empty($pageSize)) {
         $this->setListPageSize($pageSize);
     }
     parent::init();
 }