示例#1
0
 public function actionIndex()
 {
     $catId = intval(EnvUtil::getRequest("catid"));
     if (EnvUtil::submitCheck("search")) {
         $key = $_POST["keyword"];
         $list = Position::model()->fetchAll("`posname` LIKE '%{$key}%'");
     } else {
         $catContidion = empty($catId) ? "" : "catid = {$catId}";
         $count = Position::model()->count($catContidion);
         $pages = PageUtil::create($count);
         $list = Position::model()->fetchAllByCatId($catId, $pages->getLimit(), $pages->getOffset());
         $data["pages"] = $pages;
     }
     foreach ($list as $k => $pos) {
         $list[$k]["num"] = User::model()->count("positionid = :positionid AND status != 2", array(":positionid" => $pos["positionid"]));
     }
     $data["catid"] = $catId;
     $catData = PositionUtil::loadPositionCategory();
     $data["catData"] = $catData;
     $data["list"] = $list;
     $data["category"] = StringUtil::getTree($catData, $this->selectFormat);
     $this->setPageTitle(Ibos::lang("Position manager"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Organization"), "url" => $this->createUrl("department/index")), array("name" => Ibos::lang("Position manager"))));
     $this->render("index", $data, false, array("category"));
 }
示例#2
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);
 }
示例#3
0
 public function fetchCommentList()
 {
     $count = $this->getCommentCount();
     $limit = $this->getAttributes("limit");
     $pages = PageUtil::create($count, $limit);
     $this->setAttributes(array("offset" => $pages->getOffset(), "limit" => $pages->getLimit()));
     $var = array("list" => $this->getCommentList(), "lang" => Ibos::getLangSources(array("message.default")), "count" => $count, "limit" => $limit, "rowid" => $this->getAttributes("rowid"), "moduleuid" => $this->getAttributes("moduleuid"), "showlist" => $this->getAttributes("showlist"), "pages" => $pages);
     $content = $this->render("application.modules.weibo.views.comment.loadreply", $var, true);
     return $content;
 }
示例#4
0
 public function actionList()
 {
     $uid = Yii::app()->user->uid;
     $unreadCount = MessageContent::model()->countUnreadList($uid);
     $pageCount = MessageContent::model()->countMessageListByUid($uid, array(MessageContent::ONE_ON_ONE_CHAT, MessageContent::MULTIPLAYER_CHAT));
     $pages = PageUtil::create($pageCount);
     $list = MessageContent::model()->fetchAllMessageListByUid($uid, array(MessageContent::ONE_ON_ONE_CHAT, MessageContent::MULTIPLAYER_CHAT), $pages->getLimit(), $pages->getOffset());
     $data = array("datas" => $list, "pages" => $pages, "unreadCount" => $unreadCount);
     $this->ajaxReturn($data, "JSONP");
 }
示例#5
0
 public function actionIndex()
 {
     $count = EmailWeb::model()->countByAttributes(array("uid" => $this->uid));
     $pages = PageUtil::create($count, $this->getListPageSize());
     $list = EmailWeb::model()->fetchByList($this->uid, $pages->getOffset(), $pages->getLimit());
     $data = array("pages" => $pages, "list" => $list);
     $this->setPageTitle(Ibos::lang("Web email"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Personal Office")), array("name" => Ibos::lang("Email center"), "url" => $this->createUrl("list/index")), array("name" => Ibos::lang("Web email"))));
     $this->render("index", $data);
 }
示例#6
0
 protected function setPages()
 {
     $dataReader = Ibos::app()->db->createCommand()->select("count(*)")->from("{{flow_run_process}} frp")->leftJoin("{{flow_run}} fr", "frp.runid = fr.runid")->leftJoin("{{flow_type}} ft", "fr.flowid = ft.flowid")->where($this->getCondition())->group($this->getQueryGroup())->query();
     $count = $dataReader->count();
     $pages = PageUtil::create($count, $this->getPageSize());
     if ($this->getKeyword() != "" && $count) {
         $pages->params = array("keyword" => $this->getKeyword());
     }
     $this->setOffset($pages->getOffset());
     $this->setLimit($pages->getLimit());
     $this->_var["pages"] = $pages;
 }
示例#7
0
 public function actionDetail()
 {
     $uid = Yii::app()->user->uid;
     $module = EnvUtil::getRequest("module");
     $pageCount = Yii::app()->db->createCommand()->select("count(id)")->from("{{notify_message}}")->where("uid={$uid} AND module = '{$module}'")->group("module")->queryScalar();
     $pages = PageUtil::create($pageCount);
     $list = NotifyMessage::model()->fetchAllDetailByTimeLine($uid, $module, $pages->getLimit(), $pages->getOffset());
     $data = array("list" => $list, "pages" => $pages);
     NotifyMessage::model()->setReadByModule($uid, $module);
     $this->setPageTitle(Ibos::lang("Detail notify"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Message center"), "url" => $this->createUrl("mention/index")), array("name" => Ibos::lang("Notify"), "url" => $this->createUrl("notify/index")), array("name" => Ibos::lang("Detail notify"))));
     $this->render("detail", $data);
 }
示例#8
0
 public function actionIndex()
 {
     $uid = Yii::app()->user->uid;
     MessageUser::model()->setMessageIsRead($uid, EnvUtil::getRequest("id"), 1);
     $unreadCount = MessageContent::model()->countUnreadList($uid);
     $pageCount = MessageContent::model()->countMessageListByUid($uid, array(MessageContent::ONE_ON_ONE_CHAT, MessageContent::MULTIPLAYER_CHAT));
     $pages = PageUtil::create($pageCount);
     $list = MessageContent::model()->fetchAllMessageListByUid($uid, array(MessageContent::ONE_ON_ONE_CHAT, MessageContent::MULTIPLAYER_CHAT), $pages->getLimit(), $pages->getOffset());
     $data = array("list" => $list, "pages" => $pages, "unreadCount" => $unreadCount);
     $this->setPageTitle(Ibos::lang("PM"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Message center"), "url" => $this->createUrl("mention/index")), array("name" => Ibos::lang("PM"))));
     $this->render("index", $data);
 }
示例#9
0
 public function actionIndex()
 {
     $uid = Ibos::app()->user->uid;
     $unreadAtMe = UserData::model()->countUnreadAtMeByUid($uid);
     $pageCount = Atme::model()->countByAttributes(array("uid" => $uid));
     $pages = PageUtil::create($pageCount);
     $atList = Atme::model()->fetchAllAtmeListByUid($uid, $pages->getLimit(), $pages->getOffset());
     $feedIds = ConvertUtil::getSubByKey($atList, "feedid");
     $diggArr = FeedDigg::model()->checkIsDigg($feedIds, $uid);
     $data = array("unreadAtmeCount" => $unreadAtMe, "list" => $atList, "pages" => $pages, "digg" => $diggArr);
     $this->setPageTitle(Ibos::lang("Mention me"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Message center"), "url" => $this->createUrl("mention/index")), array("name" => Ibos::lang("Mention me"))));
     $this->render("index", $data);
 }
示例#10
0
 public static function search($conditions, $tableDriver, $countOnly = false, $length = 20)
 {
     global $page;
     $list = array();
     $tableId = $conditions["sourcetableid"] ? $conditions["sourcetableid"] : 0;
     $sql = $tableDriver["mainTable"]::model()->getSplitSearchContdition($conditions);
     $count = $tableDriver["mainTable"]::model()->countBySplitCondition($tableId, $sql);
     if ($countOnly) {
         return $count;
     } else {
         $page = PageUtil::create($count, $length);
         $list = $tableDriver["mainTable"]::model()->fetchAllBySplitCondition($tableId, $sql, $page->getOffset(), $page->getLimit());
     }
     return $list;
 }
示例#11
0
 public function actionIndex()
 {
     $fields = "ft.name as typeName,fr.name as runName,fr.*";
     $sort = "fr.runid DESC";
     $sql = sprintf(" AND beginuser = %d", $this->uid);
     $condition = array("and", sprintf("delflag = 1%s", $sql));
     $count = Ibos::app()->db->createCommand()->select("count(*) as count")->from("{{flow_run}} fr")->leftJoin("{{flow_type}} ft", "fr.flowid = ft.flowid")->where($condition)->queryScalar();
     $pages = PageUtil::create($count, $this->getListPageSize());
     $offset = $pages->getOffset();
     $limit = $pages->getLimit();
     $list = Ibos::app()->db->createCommand()->select($fields)->from("{{flow_run}} fr")->leftJoin("{{flow_type}} ft", "fr.flowid = ft.flowid")->where($condition)->order($sort)->offset($offset)->limit($limit)->queryAll();
     $data = array_merge(array("pages" => $pages), $this->handleList($list));
     $this->setPageTitle(Ibos::lang("Work recycle"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Workflow")), array("name" => Ibos::lang(Ibos::lang("Work recycle")), "url" => $this->createUrl("recycle/index")), array("name" => Ibos::lang("List"))));
     $this->render("index", $data);
 }
示例#12
0
 public function actionSetup()
 {
     $formSubmit = EnvUtil::submitCheck("announcementSubmit");
     if ($formSubmit) {
         $sort = $_POST["sort"];
         foreach ($sort as $id => $value) {
             Announcement::model()->modify($id, array("sort" => $value));
         }
         $this->success(Ibos::lang("Save succeed", "message"));
     } else {
         $data = array();
         $count = Announcement::model()->count(array("select" => "id"));
         $pages = PageUtil::create($count);
         $list = Announcement::model()->fetchAllOnList($pages->getLimit(), $pages->getOffset());
         $data["list"] = $list;
         $data["pages"] = $pages;
         $this->render("setup", $data);
     }
 }
示例#13
0
 private function search($kw)
 {
     $search["keyword"] = $kw;
     $condition = array();
     $condition = EmailUtil::mergeSearchCondition($search, Yii::app()->user->uid);
     $conditionStr = base64_encode(serialize($condition));
     if (empty($condition)) {
         $this->error(Ibos::lang("Request tainting", "error"), $this->createUrl("list/index"));
     }
     $emailData = Email::model()->fetchAllByArchiveIds("*", $condition["condition"], $condition["archiveId"], array("e", "eb"), null, null, SORT_DESC, "emailid");
     $count = count($emailData);
     $pages = PageUtil::create($count, 10, false);
     $pages->params = array("condition" => $conditionStr);
     $list = array_slice($emailData, $pages->getOffset(), $pages->getLimit(), false);
     foreach ($list as $index => &$mail) {
         $mail["fromuser"] = $mail["fromid"] ? User::model()->fetchRealnameByUid($mail["fromid"]) : "";
     }
     $return = array("datas" => $list, "pages" => array("pageCount" => $pages->getPageCount(), "page" => $pages->getCurrentPage(), "pageSize" => $pages->getPageSize()));
     $this->ajaxReturn($return, "JSONP");
 }
示例#14
0
 private function getListData($operation)
 {
     $data["op"] = $operation;
     $data["fid"] = $this->fid;
     $data["webId"] = $this->webId;
     $data["folders"] = $this->folders;
     $data["archiveId"] = $this->archiveId;
     $data["allowRecall"] = Yii::app()->setting->get("setting/emailrecall");
     $uid = $this->uid;
     if ($operation == "archive") {
         if (!in_array($this->subOp, array("in", "send"))) {
             $this->subOp = "in";
         }
     }
     $data["subOp"] = $this->subOp;
     $count = Email::model()->countByListParam($operation, $uid, $data["fid"], $data["archiveId"], $data["subOp"]);
     $pages = PageUtil::create($count, $this->getListPageSize());
     $data["pages"] = $pages;
     $data["unreadCount"] = Email::model()->countUnreadByListParam($operation, $uid, $data["fid"], $data["archiveId"], $data["subOp"]);
     $data["list"] = Email::model()->fetchAllByListParam($operation, $uid, $data["fid"], $data["archiveId"], $pages->getLimit(), $pages->getOffset(), $data["subOp"]);
     return $data;
 }
示例#15
0
 public function actionIndex()
 {
     $this->catid = intval(EnvUtil::getRequest("catid"));
     $this->category = FlowCategory::model()->fetchAllByUserPurv($this->uid);
     $catId = $this->getCatId();
     $keyword = EnvUtil::getRequest("keyword");
     if (!empty($keyword)) {
         $keyword = StringUtil::filterCleanHtml($keyword);
     } else {
         $keyword = "";
     }
     if (EnvUtil::getRequest("inajax") == "1") {
         $limit = intval(EnvUtil::getRequest("limit"));
         $offset = intval(EnvUtil::getRequest("offset"));
         $condition = $catId ? "ff.catid = " . intval($catId) : "1";
         if (!empty($keyword)) {
             $condition .= " AND ff.formname LIKE '%{$keyword}%'";
         }
         $list = FlowFormType::model()->fetchAllByList($condition, $offset, $limit);
         $list = $this->handleFormData($list);
         $count = count($list);
         $this->ajaxReturn(array("count" => $count, "list" => $list));
     } else {
         if (isset($_GET["pagesize"])) {
             $this->setListPageSize($_GET["pagesize"]);
         }
         $condition = $catId ? "catid = " . intval($catId) : "1";
         if (!empty($keyword)) {
             $condition .= " AND t.formname LIKE '%{$keyword}%'";
         }
         $count = FlowFormType::model()->countByCondition($condition);
         $pages = PageUtil::create($count, $this->getListPageSize());
         $data = array("limit" => $pages->getLimit(), "offset" => $pages->getOffset(), "pageSize" => $this->getListPageSize(), "keyword" => $keyword, "pages" => $pages, "count" => $count, "category" => $this->category, "catId" => $this->catid);
         $this->setPageTitle(Ibos::lang("Form library manager"));
         $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Workflow")), array("name" => Ibos::lang("Form library manager"), "url" => $this->createUrl("formtype/index")), array("name" => Ibos::lang("List"))));
         $this->render("index", $data);
     }
 }
示例#16
0
 public function actionIndex()
 {
     $uid = Ibos::app()->user->uid;
     $type = EnvUtil::getRequest("type");
     $map = array("and");
     if (!in_array($type, array("receive", "sent"))) {
         $type = "receive";
     }
     if ($type == "receive") {
         $con = "touid = '{$uid}' AND uid != '{$uid}' AND `isdel` = 0";
     } else {
         $con = "`uid` = {$uid} AND `isdel` = 0";
     }
     $map[] = $con;
     $count = Comment::model()->count($con . " AND `isdel` = 0");
     $pages = PageUtil::create($count);
     $list = Comment::model()->getCommentList($map, "cid DESC", $pages->getLimit(), $pages->getOffset(), true);
     $data = array("list" => $list, "type" => $type, "pages" => $pages);
     UserData::model()->resetUserCount($uid, "unread_comment", 0);
     $this->setPageTitle(Ibos::lang("Comment"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Message center"), "url" => $this->createUrl("mention/index")), array("name" => Ibos::lang("Comment"), "url" => $this->createUrl("comment/index"))));
     $this->render("index", $data);
 }
示例#17
0
 public function actionIndex()
 {
     $deptId = intval(EnvUtil::getRequest("deptid"));
     if (EnvUtil::getRequest("op") == "tree") {
         return $this->getDeptTree();
     }
     $type = EnvUtil::getRequest("type");
     if (!in_array($type, array("enabled", "lock", "disabled", "all"))) {
         $type = "enabled";
     }
     $data = array();
     if (EnvUtil::submitCheck("search")) {
         $key = $_POST["keyword"];
         $condition = User::model()->getConditionByDeptIdType(false, $type);
         $list = User::model()->fetchAll("(`username` LIKE '%{$key}%' OR `realname` LIKE '%{$key}%') AND " . $condition);
     } else {
         $count = User::model()->countByDeptIdType($deptId, $type);
         $pages = PageUtil::create($count);
         $list = User::model()->fetchAllByDeptIdType($deptId, $type, $pages->getLimit(), $pages->getOffset());
         $data["pages"] = $pages;
     }
     //var_dump($list);exit;
     $data["list"] = $this->handleUserListByPurv($list);
     $data["deptId"] = $deptId;
     $data["type"] = $type;
     $managerVal = NodeRelated::model()->fetchDataValByIdentifier("organization/user/view", Ibos::app()->user->positionid);
     if ($managerVal) {
         $param = array("purvId" => $managerVal);
     } else {
         $param = array();
     }
     $data["perManager"] = Ibos::app()->user->checkAccess("organization/user/add", $param);
     $this->setPageTitle(Ibos::lang("User manager"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Organization"), "url" => $this->createUrl("department/index")), array("name" => Ibos::lang("User manager"), "url" => $this->createUrl("user/index")), array("name" => Ibos::lang("User list"))));
     $this->render("index", $data);
 }
示例#18
0
 public function actionIndex()
 {
     $keyword = EnvUtil::getRequest("keyword");
     if (!empty($keyword)) {
         $keyword = StringUtil::filterCleanHtml($keyword);
     } else {
         $keyword = "";
     }
     if (isset($_GET["pagesize"])) {
         $this->setListPageSize($_GET["pagesize"]);
     }
     $catId = $this->getCatId();
     $condition = $catId ? "ft.catid = " . intval($catId) : "1";
     if (!empty($keyword)) {
         $condition .= " AND ft.name LIKE '%{$keyword}%'";
     }
     $count = FlowType::model()->countByList($condition);
     $pages = PageUtil::create($count, $this->getListPageSize());
     $list = FlowType::model()->fetchAllByList($this->uid, $condition, $pages->getOffset(), $pages->getLimit());
     $data = array("list" => $list, "pages" => $pages, "category" => $this->category, "catId" => $this->catid, "pageSize" => $this->getListPageSize());
     $this->setPageTitle(Ibos::lang("Workflow manager"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Workflow")), array("name" => Ibos::lang("Workflow manager"), "url" => $this->createUrl("type/index")), array("name" => Ibos::lang("List"))));
     $this->render("index", $data);
 }
示例#19
0
 public function actionLog()
 {
     $formSubmit = EnvUtil::submitCheck("securitySubmit");
     if ($formSubmit) {
         CacheUtil::update(array("setting"));
         $this->success(Ibos::lang("Save succeed", "message"));
     } else {
         $data = array();
         $levels = array("admincp", "banned", "illegal", "login");
         $level = EnvUtil::getRequest("level");
         $filterAct = EnvUtil::getRequest("filteract");
         $timeScope = EnvUtil::getRequest("timescope");
         if (!in_array($level, $levels)) {
             $level = "admincp";
         }
         $conArr = array("level" => $level);
         $condition = "level = '{$level}'";
         if (!empty($filterAct)) {
             $condition .= sprintf(" AND category = 'module.dashboard.%s'", $filterAct);
             $conArr["filteract"] = $filterAct;
         } else {
             $condition .= " AND 1";
         }
         if (!empty($timeScope)) {
             $start = EnvUtil::getRequest("start");
             $end = EnvUtil::getRequest("end");
             $tableId = intval($timeScope);
             $conArr["timescope"] = $tableId;
             if (!empty($start) && !empty($end)) {
                 $conArr["start"] = $start;
                 $conArr["end"] = $end;
                 $start = strtotime($tableId . "-" . $start);
                 $end = strtotime($tableId . "-" . $end);
                 $condition .= sprintf(" AND `logtime` BETWEEN %d AND %d", $start, $end);
             } elseif (!empty($start)) {
                 $conArr["start"] = $start;
                 $start = strtotime($tableId . "-" . $start);
                 $condition .= sprintf(" AND `logtime` > %d", $start);
             } elseif (!empty($end)) {
                 $conArr["end"] = $end;
                 $end = strtotime($tableId . "-" . $end);
                 $condition .= sprintf(" AND `logtime` < %d", $end);
             }
         } else {
             $tableId = 0;
             $lastMonth = strtotime("last month");
             $condition .= sprintf(" AND `logtime` BETWEEN %d AND %d", $lastMonth, TIMESTAMP);
         }
         $count = Log::countByTableId($tableId, $condition);
         $pages = PageUtil::create($count, 20);
         $log = Log::fetchAllByList($tableId, $condition, $pages->getLimit(), $pages->getOffset());
         $data["log"] = $log;
         $data["pages"] = $pages;
         if ($level == "admincp") {
             $data["actions"] = Ibos::getLangSource("dashboard.actions");
         }
         $data["filterAct"] = $filterAct;
         $data["level"] = $level;
         $data["archive"] = Log::getAllArchiveTableId();
         $data["con"] = $conArr;
         $this->render("log", $data);
     }
 }
示例#20
0
 protected function getListData($op)
 {
     switch ($op) {
         case "rule":
         case "berule":
             if ($op == "rule") {
                 $where = "fr.uid = {$this->uid}";
             } else {
                 $where = "fr.toid = {$this->uid} AND fr.status = 1";
             }
             $sqlText = "SELECT fr.*,ft.name as typeName,fr.toid as userID FROM {{flow_rule}} fr LEFT JOIN {{flow_type}} ft ON ft.flowid = fr.flowid LEFT JOIN {{user}} u ON fr.toid = u.uid WHERE {$where} ORDER BY fr.ruleid DESC";
             break;
         case "record":
         case "berecord":
             if ($op == "record") {
                 $idField = "uid";
             } else {
                 $idField = "toid";
             }
             $sqlText = "SELECT log.flowid,log.runid,log.runname,log.processid,log.toid as userID,log.time,frp.flag,frp.flowprocess,ft.type,ft.name as typeName,ft.flowid FROM {{flow_run_log}} log INNER JOIN {{flow_type}} ft ON log.flowid = ft.flowid LEFT JOIN {{flow_run_process}} frp ON frp.runid = log.runid WHERE frp.processid = log.processid AND log.{$idField} = {$this->uid} AND log.type = 2 GROUP BY log.processid ORDER BY log.runid DESC";
             break;
     }
     $query = Ibos::app()->db->createCommand()->setText($sqlText)->query();
     $count = $query->count();
     $pages = PageUtil::create($count, $this->getListPageSize());
     $offset = $pages->getOffset();
     $limit = $pages->getLimit();
     $list = Ibos::app()->db->createCommand()->setText($sqlText . " LIMIT {$offset},{$limit}")->queryAll();
     $now = strtotime(date("Y-m-d", TIMESTAMP));
     $proceses = FlowProcess::model()->fetchAllProcessSortByFlowId();
     foreach ($list as &$rec) {
         if ($op == "rule" || $op == "berule") {
             $condition1 = WfHandleUtil::compareTimestamp($now, $rec["begindate"]);
             $condition2 = WfHandleUtil::compareTimestamp($now, $rec["enddate"]);
             $rec["enabled"] = false;
             $rec["datedesc"] = "";
             if ($rec["status"] == 1) {
                 if ($rec["begindate"] != 0 && $rec["enddate"] != 0) {
                     $rec["datedesc"] = date("Y-m-d", $rec["begindate"]) . "--" . date("Y-m-d", $rec["enddate"]);
                     if (0 <= $condition1 && $condition2 <= 0) {
                         $rec["enabled"] = true;
                     }
                 } elseif ($rec["begindate"] != 0) {
                     $rec["datedesc"] = Ibos::lang("Entrust begin with", "", array("{date}" => date("Y-m-d", $rec["begindate"])));
                     if (0 <= $condition1) {
                         $rec["enabled"] = true;
                     }
                 } elseif ($rec["enddate"] != 0) {
                     $rec["datedesc"] = Ibos::lang("Entrust finish up width", "", array("{date}" => date("Y-m-d", $rec["enddate"])));
                     if ($condition2 <= 0) {
                         $rec["enabled"] = true;
                     }
                 } else {
                     $rec["datedesc"] = Ibos::lang("Always effective");
                     $rec["enabled"] = true;
                 }
             }
         } else {
             $rec["key"] = WfCommonUtil::param(array("runid" => $rec["runid"], "processid" => $rec["processid"], "flowprocess" => $rec["flowprocess"], "flowid" => $rec["flowid"]));
             if ($rec["type"] == 1) {
                 if (isset($proceses[$rec["flowid"]][$rec["flowprocess"]])) {
                     $rec["processname"] = $proceses[$rec["flowid"]][$rec["flowprocess"]]["name"];
                 }
             } else {
                 $rec["processname"] = Ibos::lang("Steps", "", array("{step}" => $rec["processid"]));
             }
         }
         $rec["user"] = User::model()->fetchByUid($rec["userID"]);
     }
     return array("pages" => $pages, "list" => $list);
 }
示例#21
0
 public function actionSecurity()
 {
     $operation = EnvUtil::getRequest("op");
     if (!in_array($operation, array("setup", "ip", "log"))) {
         $operation = "setup";
     }
     $formSubmit = EnvUtil::submitCheck("securitySubmit");
     if ($formSubmit) {
         switch ($operation) {
             case "setup":
                 $fields = array("expiration", "minlength", "mixed", "errorlimit", "errorrepeat", "errortime", "autologin", "allowshare", "timeout");
                 $updateList = array();
                 foreach ($fields as $field) {
                     if (!isset($_POST[$field])) {
                         $_POST[$field] = 0;
                     }
                     $updateList[$field] = $_POST[$field];
                 }
                 if (intval($updateList["timeout"]) == 0) {
                     $this->error("请填写一个正确的大于0的超时时间值");
                 }
                 Setting::model()->updateSettingValueByKey("account", $updateList);
                 break;
             case "ip":
                 if ($_POST["act"] == "") {
                     if (isset($_POST["ip"])) {
                         foreach ($_POST["ip"] as $new) {
                             if ($new["ip1"] != "" && $new["ip2"] != "" && $new["ip3"] != "" && $new["ip4"] != "") {
                                 $own = 0;
                                 $ip = explode(".", Ibos::app()->setting->get("clientip"));
                                 for ($i = 1; $i <= 4; $i++) {
                                     if (!is_numeric($new["ip" . $i]) || $new["ip" . $i] < 0) {
                                         $new["ip" . $i] = -1;
                                         $own++;
                                     } elseif ($new["ip" . $i] == $ip[$i - 1]) {
                                         $own++;
                                     }
                                     $new["ip" . $i] = intval($new["ip" . $i]);
                                 }
                                 if ($own == 4) {
                                     $this->error(Ibos::lang("Ipban illegal"));
                                 }
                                 $expiration = TIMESTAMP + $new["validitynew"] * 86400;
                                 $new["admin"] = Ibos::app()->user->username;
                                 $new["dateline"] = TIMESTAMP;
                                 $new["expiration"] = $expiration;
                                 IpBanned::model()->add($new);
                             }
                         }
                     }
                     if (isset($_POST["expiration"])) {
                         $userName = Ibos::app()->user->username;
                         foreach ($_POST["expiration"] as $id => $expiration) {
                             IpBanned::model()->updateExpirationById($id, strtotime($expiration), $userName);
                         }
                     }
                 } elseif ($_POST["act"] == "del") {
                     if (is_array($_POST["id"])) {
                         IpBanned::model()->deleteByPk($_POST["id"]);
                     }
                 } elseif ($_POST["act"] == "clear") {
                     $command = Ibos::app()->db->createCommand();
                     $command->delete("{{ipbanned}}");
                 }
                 CacheUtil::update("ipbanned");
                 break;
             default:
                 break;
         }
         CacheUtil::update(array("setting"));
         $this->success(Ibos::lang("Save succeed", "message"));
     } else {
         $data = array();
         switch ($operation) {
             case "setup":
                 $account = Setting::model()->fetchSettingValueByKey("account");
                 $data["account"] = unserialize($account);
                 break;
             case "ip":
                 $lists = IpBanned::model()->fetchAllOrderDateline();
                 $list = array();
                 foreach ($lists as $banned) {
                     for ($i = 1; $i <= 4; $i++) {
                         if ($banned["ip{$i}"] == -1) {
                             $banned["ip{$i}"] = "*";
                         }
                     }
                     $banned["dateline"] = date("Y-m-d", $banned["dateline"]);
                     $banned["expiration"] = date("Y-m-d", $banned["expiration"]);
                     $displayIp = "{$banned["ip1"]}.{$banned["ip2"]}.{$banned["ip3"]}.{$banned["ip4"]}";
                     $banned["display"] = $displayIp;
                     $banned["scope"] = ConvertUtil::convertIp($displayIp);
                     $list[] = $banned;
                 }
                 $data["list"] = $list;
                 break;
             case "log":
                 $levels = array("admincp", "banned", "illegal", "login");
                 $level = EnvUtil::getRequest("level");
                 $filterAct = EnvUtil::getRequest("filteract");
                 $timeScope = EnvUtil::getRequest("timescope");
                 if (!in_array($level, $levels)) {
                     $level = "admincp";
                 }
                 $conArr = array("op" => "log", "level" => $level);
                 $condition = "level = '{$level}'";
                 if (!empty($filterAct)) {
                     $condition .= sprintf(" AND category = 'module.dashboard.%s'", $filterAct);
                     $conArr["filteract"] = $filterAct;
                 } else {
                     $condition .= " AND 1";
                 }
                 if (!empty($timeScope)) {
                     $start = EnvUtil::getRequest("start");
                     $end = EnvUtil::getRequest("end");
                     $tableId = intval($timeScope);
                     $conArr["timescope"] = $tableId;
                     if (!empty($start) && !empty($end)) {
                         $conArr["start"] = $start;
                         $conArr["end"] = $end;
                         $start = strtotime($tableId . "-" . $start);
                         $end = strtotime($tableId . "-" . $end);
                         $condition .= sprintf(" AND `logtime` BETWEEN %d AND %d", $start, $end);
                     } elseif (!empty($start)) {
                         $conArr["start"] = $start;
                         $start = strtotime($tableId . "-" . $start);
                         $condition .= sprintf(" AND `logtime` > %d", $start);
                     } elseif (!empty($end)) {
                         $conArr["end"] = $end;
                         $end = strtotime($tableId . "-" . $end);
                         $condition .= sprintf(" AND `logtime` < %d", $end);
                     }
                 } else {
                     $tableId = 0;
                     $lastMonth = strtotime("last month");
                     $condition .= sprintf(" AND `logtime` BETWEEN %d AND %d", $lastMonth, TIMESTAMP);
                 }
                 $count = Log::countByTableId($tableId, $condition);
                 $pages = PageUtil::create($count, 20);
                 $log = Log::fetchAllByList($tableId, $condition, $pages->getLimit(), $pages->getOffset());
                 $data["log"] = $log;
                 $data["pages"] = $pages;
                 if ($level == "admincp") {
                     $data["actions"] = Ibos::getLangSource("dashboard.actions");
                 }
                 $data["filterAct"] = $filterAct;
                 $data["level"] = $level;
                 $data["archive"] = Log::getAllArchiveTableId();
                 $data["con"] = $conArr;
                 break;
             default:
                 break;
         }
         $this->render("security" . ucfirst($operation), $data);
     }
 }
示例#22
0
 protected function getListData()
 {
     if (EnvUtil::submitCheck("formhash")) {
         $runid = intval(EnvUtil::getRequest("runid"));
         $flowid = intval(EnvUtil::getRequest("flowid"));
         $userType = EnvUtil::getRequest("usertype");
         $runName = StringUtil::filterCleanHtml(EnvUtil::getRequest("runname"));
         $toid = !empty($_POST["toid"]) ? implode(",", StringUtil::getId($_POST["toid"])) : "";
     } else {
         $runid = 0;
         $userType = $runName = $toid = "";
         $flowid = "all";
     }
     $flowIds = WfQueryUtil::getMyFlowIDs($this->uid);
     if (empty($flowIds)) {
         $flowIds = array(0);
     }
     $condition = array("and", "fr.delflag = 0", array("in", "fr.flowid", $flowIds), array("in", "frp.flag", array(1, 2)), "(frp.opflag = 1 OR frp.topflag = 2)");
     $field = "frp.runid,frp.processid,frp.uid,frp.flag,frp.processtime,frp.flowprocess,fr.attachmentid,fr.focususer,ft.freeother";
     if ($flowid !== "all") {
         $condition[] = "ft.flowid = " . $flowid;
     }
     if (!empty($runid)) {
         $condition[] = "fr.runid = " . $runid;
     }
     if (!empty($runName)) {
         $condition[] = " fr.name LIKE '%{$runName}%'";
     }
     if ($toid != "") {
         if ($userType == "opuser") {
             $condition[] = "frp.uid = {$toid}";
         } else {
             $condition[] = "fr.beginuser = {$toid}";
         }
     }
     $lang = Ibos::getLangSource("workflow.default");
     $count = Ibos::app()->db->createCommand()->select("count(fr.runid)")->from("{{flow_run}} fr")->leftJoin("{{flow_type}} ft", "fr.flowid = ft.flowid")->leftJoin("{{flow_run_process}} frp", "fr.runid = frp.runid")->where($condition)->queryScalar();
     $pages = PageUtil::create($count, $this->getListPageSize());
     $list = Ibos::app()->db->createCommand()->select($field)->from("{{flow_run}} fr")->leftJoin("{{flow_type}} ft", "fr.flowid = ft.flowid")->leftJoin("{{flow_run_process}} frp", "fr.runid = frp.runid")->where($condition)->group("frp.runid")->order("frp.runid DESC")->limit($pages->getLimit())->offset($pages->getOffset())->queryAll();
     foreach ($list as $k => &$rec) {
         $temp = Ibos::app()->db->createCommand()->select("ft.flowid,ft.freeother,fr.name as runName,ft.name as typeName,ft.type,ft.sort")->from("{{flow_type}} ft")->leftJoin("{{flow_run}} fr", "fr.flowid = ft.flowid")->where("fr.runid = " . $rec["runid"])->queryRow();
         if ($temp) {
             $rec = array_merge($rec, $temp);
         } else {
             continue;
         }
         if ($temp["type"] == 1) {
             $fp = FlowProcess::model()->fetchProcess($temp["flowid"], $rec["flowprocess"]);
             if ($fp) {
                 $rec["stepname"] = $fp["name"];
             } else {
                 $rec["stepname"] = $lang["Process steps already deleted"];
             }
         } else {
             $rec["stepname"] = Ibos::lang("Step", "", array("{step}" => $rec["processid"]));
         }
         if ($rec["flag"] == FlowConst::PRCS_UN_RECEIVE) {
             $deliverTime = FlowRunProcess::model()->fetchDeliverTime($rec["runid"], $rec["flowprocess"]);
             if ($deliverTime) {
                 $prcsBeginTime = $deliverTime;
             }
         } else {
             $prcsBeginTime = $rec["processtime"];
         }
         if (!isset($prcsBeginTime) || $prcsBeginTime == 0) {
             $prcsBeginTime = TIMESTAMP;
         }
         $usedTime = TIMESTAMP - $prcsBeginTime;
         $rec["timestr"] = WfCommonUtil::getTime($usedTime, "dhi");
         if (!empty($rec["attachmentid"])) {
             $rec["attachdata"] = AttachUtil::getAttachData($rec["attachmentid"]);
         }
         $rec["focus"] = StringUtil::findIn($this->uid, $rec["focususer"]);
         $rec["user"] = User::model()->fetchByUid($rec["uid"]);
         $rec["key"] = WfCommonUtil::param(array("flowid" => $rec["flowid"], "runid" => $rec["runid"], "processid" => $rec["processid"], "flowprocess" => $rec["flowprocess"]));
         if (empty($rec["user"])) {
             unset($list[$k]);
         }
     }
     return array("list" => $list, "pages" => $pages);
 }
示例#23
0
 protected function getListData()
 {
     $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");
     $flag = $this->typeMapping[$this->type];
     $condition = array("and", "fr.delflag = 0", "frp.childrun = 0", sprintf("frp.uid = %d", $this->uid));
     if ($flag == self::DONE) {
         $condition[] = "fr.endtime != '0'";
     } else {
         $condition[] = array("in", "frp.flag", explode(",", $flag));
     }
     $sort = "frp.runid DESC";
     $group = "";
     if ($this->getIsOver()) {
         if ($this->type == "trans") {
             $sort = "frp.processtime DESC";
         } else {
             $sort = "fr.endtime DESC";
         }
         $group = "frp.runid";
     } elseif ($this->getIsTodo()) {
         $sort = "frp.createtime DESC";
     } elseif ($this->getIsDelay()) {
         $sort = "frp.flag DESC";
     }
     if ($this->sort == "host") {
         $condition[] = "frp.opflag = 1";
     } elseif ($this->sort == "sign") {
         $condition[] = "frp.opflag = 0";
     } elseif ($this->sort == "rollback") {
         $condition[] = "frp.processid != frp.flowprocess";
     }
     if ($this->flowid !== "") {
         $condition[] = "fr.flowid = " . $this->flowid;
     }
     $key = StringUtil::filterCleanHtml(EnvUtil::getRequest("keyword"));
     if ($key) {
         $condition[] = array("or", "fr.runid LIKE '%{$key}%'", "fr.name LIKE '%{$key}%'");
     }
     if ($this->op == "list") {
         $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, self::DEFAULT_PAGE_SIZE);
         if ($key && $count) {
             $pages->params = array("keyword" => $key);
         }
         $offset = $pages->getOffset();
         $limit = $pages->getLimit();
     } else {
         $offset = $limit = -1;
     }
     $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($offset)->limit($limit)->queryAll();
     if ($this->op == "list") {
         return array_merge(array("pages" => array("pageCount" => $pages->getPageCount(), "page" => $pages->getCurrentPage(), "pageSize" => $pages->getPageSize())), $this->handleList($runProcess, $flag));
     } elseif ($this->op == "category") {
         return $this->handleCategory($runProcess);
     }
 }
示例#24
0
 protected function getCreditRule()
 {
     $count = CreditRule::model()->count();
     $pages = PageUtil::create($count);
     $creditRule = CreditRule::model()->fetchAllSortByPk("rid", array("offset" => $pages->getOffset(), "limit" => $pages->getLimit()));
     $credits = Ibos::app()->setting->get("setting/extcredits");
     return array("credits" => $credits, "creditRule" => $creditRule, "pages" => $pages);
 }
示例#25
0
 public function actionComment()
 {
     $op = EnvUtil::getRequest("op");
     if (EnvUtil::submitCheck("formhash")) {
         if (!in_array($op, array("delComment", "deleteComment", "commentRecover"))) {
             exit;
         }
         $ids = EnvUtil::getRequest("ids");
         foreach (explode(",", $ids) as $id) {
             Comment::model()->doEditComment($id, $op);
         }
         $this->ajaxReturn(array("isSuccess" => true));
     } else {
         if (!in_array($op, array("list", "recycle"))) {
             $op = "list";
         }
         $map = "";
         if ($op == "list") {
             $map = "isdel = 0";
         } else {
             $map = "isdel = 1";
         }
         if (EnvUtil::getRequest("search")) {
             $key = StringUtil::filterCleanHtml(EnvUtil::getRequest("search"));
             $map .= " AND content LIKE '%{$key}%'";
         }
         $count = Comment::model()->count($map);
         $pages = PageUtil::create($count);
         $list = Comment::model()->getCommentList($map, "cid DESC", $pages->getLimit(), $pages->getOffset());
         $data = array("op" => $op, "list" => $list, "pages" => $pages, "moduleAssetUrl" => Ibos::app()->assetManager->getAssetsUrl("weibo"));
         $this->render("comment", $data);
     }
 }
示例#26
0
 protected function getData($var)
 {
     $data = array();
     $type = isset($var["new"]) ? "new" . $var["type"] : $var["type"];
     $where = "isdel = 0 AND uid = " . $this->getUid() . ($this->getIsMe() ? "" : " AND " . WbfeedUtil::getViewCondition(Ibos::app()->user->uid));
     switch ($type) {
         case "all":
             $pages = PageUtil::create(WbConst::MAX_VIEW_FEED_NUMS, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $loadId = isset($var["loadId"]) ? $var["loadId"] : 0;
                 $list = Feed::model()->searchFeed($var["feedkey"], "all", $loadId, $var["nums"], $pages->getOffset(), "", $this->getUid());
                 $count = Feed::model()->countSearchAll($var["feedkey"], $loadId);
             } else {
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND type = '" . StringUtil::filterCleanHtml($var["feedtype"]) . "'";
                 }
                 $list = Feed::model()->getList($where, $var["nums"], $pages->getOffset());
                 $count = Feed::model()->count($where);
             }
             break;
         case "movement":
             $pages = PageUtil::create(WbConst::MAX_VIEW_FEED_NUMS, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $loadId = isset($var["loadId"]) ? $var["loadId"] : 0;
                 $list = Feed::model()->searchFeed($var["feedkey"], "movement", $loadId, $var["nums"], $pages->getOffset(), "", $this->getUid());
                 $count = Feed::model()->countSearchMovement($var["feedkey"], $loadId);
             } else {
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND module = '" . StringUtil::filterCleanHtml($var["feedtype"]) . "'";
                 } else {
                     $where .= " AND module != 'weibo'";
                 }
                 $list = Feed::model()->getList($where, $var["nums"], $pages->getOffset());
                 $count = Feed::model()->count($where);
             }
             break;
         case "newmovement":
             if (0 < $var["maxId"]) {
                 $where = sprintf("isdel = 0 AND %s AND feedid > %d AND uid = %d", WbfeedUtil::getViewCondition(Ibos::app()->user->uid), intval($var["maxId"]), $this->uid);
                 $list = Feed::model()->getList($where);
                 $count = Feed::model()->count($where);
                 $data["count"] = count($list);
             }
             break;
         case "newall":
             if (0 < $var["maxId"]) {
                 $where = sprintf("isdel = 0 %s AND feedid > %d AND uid = %d", $this->getIsMe() ? "" : " AND " . WbfeedUtil::getViewCondition(Ibos::app()->user->uid), intval($var["maxId"]), $this->getUid());
                 $list = Feed::model()->getList($where);
                 $count = Feed::model()->countFollowingFeed($where);
                 $data["count"] = count($list);
             }
             break;
         default:
             break;
     }
     $count = isset($count) ? $count : WbConst::MAX_VIEW_FEED_NUMS;
     $pages = PageUtil::create($count, WbConst::DEF_LIST_FEED_NUMS);
     if (!isset($var["new"])) {
         $pages->route = "personal/index";
         $currentUrl = (string) Ibos::app()->getRequest()->getUrl();
         $replaceUrl = str_replace("weibo/personal/loadmore", "weibo/personal/index", $currentUrl);
         $data["pageData"] = $this->widget("IWPage", array("pages" => $pages, "currentUrl" => $replaceUrl), true);
     }
     if (!empty($list)) {
         $data["firstId"] = $list[0]["feedid"];
         $data["lastId"] = $list[count($list) - 1]["feedid"];
         $feedids = ConvertUtil::getSubByKey($list, "feedid");
         $diggArr = FeedDigg::model()->checkIsDigg($feedids, $this->getUid());
         foreach ($list as &$v) {
             switch ($v["module"]) {
                 case "mobile":
                     break;
                 default:
                     $v["from"] = EnvUtil::getFromClient($v["from"], $v["module"]);
                     break;
             }
         }
         $data["html"] = $this->renderPartial("application.modules.message.views.feed.feedlist", array("list" => $list, "diggArr" => $diggArr), true);
     } else {
         $data["html"] = "";
         $data["firstId"] = $data["lastId"] = 0;
     }
     return $data;
 }
示例#27
0
 protected function getData($var)
 {
     $data = array();
     $type = isset($var["new"]) ? "new" . $var["type"] : $var["type"];
     switch ($type) {
         case "following":
             $pages = PageUtil::create(1000, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $list = Feed::model()->searchFeed($var["feedkey"], "following", $var["loadId"], $var["nums"], $pages->getOffset());
             } else {
                 $where = "a.isdel = 0 AND " . WbfeedUtil::getViewCondition($this->uid, "a.");
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND a.feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND a.type = '" . $var["feedtype"] . "'";
                 }
                 $list = Feed::model()->getFollowingFeed($where, $var["nums"], $pages->getOffset());
             }
             break;
         case "all":
             $pages = PageUtil::create(WbConst::MAX_VIEW_FEED_NUMS, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $list = Feed::model()->searchFeed($var["feedkey"], "all", $var["loadId"], $var["nums"], $pages->getOffset());
             } else {
                 $where = "isdel = 0 AND " . WbfeedUtil::getViewCondition($this->uid);
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND type = '" . StringUtil::filterCleanHtml($var["feedtype"]) . "'";
                 }
                 $list = Feed::model()->getList($where, $var["nums"], $pages->getOffset());
             }
             break;
         case "movement":
             $pages = PageUtil::create(WbConst::MAX_VIEW_FEED_NUMS, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $list = Feed::model()->searchFeed($var["feedkey"], "movement", $var["loadId"], $var["nums"], $pages->getOffset());
             } else {
                 $where = "isdel = 0 AND " . WbfeedUtil::getViewCondition($this->uid);
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND module = '" . StringUtil::filterCleanHtml($var["feedtype"]) . "'";
                 } else {
                     $where .= " AND module != 'weibo'";
                 }
                 $list = Feed::model()->getList($where, $var["nums"], $pages->getOffset());
             }
             break;
         case "newmovement":
             if (0 < $var["maxId"]) {
                 $where = sprintf("isdel = 0 AND %s AND feedid > %d", WbfeedUtil::getViewCondition($this->uid), intval($var["maxId"]), $this->uid);
                 $list = Feed::model()->getList($where);
                 $data["count"] = count($list);
             }
             break;
         case "newfollowing":
             $where = "a.isdel = 0 AND " . WbfeedUtil::getViewCondition($this->uid, "a.");
             if (0 < $var["maxId"]) {
                 $where .= " AND a.feedid > '" . intval($var["maxId"]) . "'";
                 $list = Feed::model()->getFollowingFeed($where);
                 $data["count"] = count($list);
             }
             break;
         case "newall":
             if (0 < $var["maxId"]) {
                 $where = sprintf("isdel = 0 AND %s AND feedid > %d AND uid <> %d", WbfeedUtil::getViewCondition($this->uid), intval($var["maxId"]), $this->uid);
                 $list = Feed::model()->getList($where);
                 $data["count"] = count($list);
             }
             break;
         default:
             break;
     }
     if (!isset($var["new"])) {
         $pages->route = "home/index";
     }
     if (!empty($list)) {
         $data["firstId"] = $list[0]["feedid"];
         $data["lastId"] = $list[count($list) - 1]["feedid"];
         $feedids = ConvertUtil::getSubByKey($list, "feedid");
         $diggArr = FeedDigg::model()->checkIsDigg($feedids, $this->uid);
         foreach ($list as &$v) {
             switch ($v["module"]) {
                 case "mobile":
                     break;
                 default:
                     $v["from"] = EnvUtil::getFromClient($v["from"], $v["module"]);
                     break;
             }
             if (isset($v["attach_id"][0])) {
                 $_tmp = AttachUtil::getAttachData($v["attach_id"][0]);
                 $v["attach_url"] = FileUtil::getAttachUrl() . "/" . $_tmp[$v["attach_id"][0]]["attachment"];
             }
             if (isset($v["api_source"]["attach"][0]["attach_url"])) {
                 $v["api_source"]["attach_url"] = $v["api_source"]["attach"][0]["attach_url"];
                 unset($v["api_source"]["attach"]);
                 unset($v["api_source"]["source_body"]);
             }
             unset($v["user_info"]);
             unset($v["body"]);
             unset($v["sourceInfo"]);
             unset($v["api_source"]["source_user_info"]);
             unset($v["api_source"]["avatar_big"]);
             unset($v["api_source"]["avatar_middle"]);
             unset($v["api_source"]["avatar_small"]);
             unset($v["api_source"]["source_url"]);
             unset($v["feeddata"]);
         }
         $data["list"] = $list;
         $data["diggArr"] = $diggArr;
     } else {
         $data["list"] = array();
         $data["firstId"] = $data["lastId"] = 0;
     }
     return $data;
 }
示例#28
0
 protected function getListData()
 {
     $param = $this->getListFilterParam();
     $field = "fr.runid,fr.name as runName,fr.begintime,fr.endtime,ft.name as typeName,fr.attachmentid,fr.focususer,fr.beginuser,ft.flowid,ft.type,ft.freeother";
     $condition = array("and", "fr.delflag = 0");
     if ($param["flowid"]) {
         $condition[] = "ft.flowid = " . $param["flowid"];
         $isManager = FlowPermission::model()->fetchPermission($this->uid, $param["flowid"], array(0, 1));
     } else {
         $isManager = false;
     }
     if ($param["start"]) {
         $condition[] = "fr.begintime >= " . $param["start"];
     }
     if ($param["end"]) {
         $condition[] = "fr.endtime <= " . $param["end"];
     }
     $flowIds = WfQueryUtil::getMyFlowIDs($this->uid);
     $myRuns = FlowRun::model()->fetchAllMyRunID($this->uid, $param["flowid"]);
     if ($param["scope"] == "none" && Ibos::app()->user->isadministrator != 1) {
         $condition[] = sprintf("(FIND_IN_SET(fr.runid,'%s') OR FIND_IN_SET(ft.flowid,'%s'))", implode(",", $myRuns), implode(",", $flowIds));
     } elseif ($param["scope"] == "start") {
         $beginUser = $this->uid;
     } elseif ($param["scope"] == "handle") {
         $condition[] = array("in", "fr.runid", $myRuns);
     } else {
         if ($param["scope"] == "manage" && Ibos::app()->user->isadministrator != 1) {
             $condition[] = sprintf("FIND_IN_SET('%s',ft.flowid)", implode(",", $flowIds));
         } elseif ($param["scope"] == "focus") {
             $implodeStr = WfCommonUtil::implodeSql($this->uid, "fr.focususer");
             $condition[] = sprintf("fr.focususer = %d%s", $this->uid, $implodeStr);
         } elseif ($param["scope"] == "custom") {
             if (Ibos::app()->user->isadministrator != 1) {
                 $condition[] = sprintf("FIND_IN_SET(ft.flowid,'%s')", implode(",", $flowIds));
             }
             $beginUser = implode(",", StringUtil::getId($param["beginuser"]));
         } elseif (Ibos::app()->user->isadministrator != 1) {
             $this->error(Ibos::lang("Parameters error", "error"));
         }
     }
     if ($param["type"] !== "all") {
         if ($param["type"] == "perform") {
             $condition[] = "fr.endtime = 0";
         } else {
             $condition[] = "fr.endtime != 0";
         }
     }
     if (isset($beginUser)) {
         $condition[] = "fr.beginuser = "******"count(fr.runid)")->from("{{flow_run}} fr")->leftJoin("{{flow_type}} ft", "fr.flowid = ft.flowid")->where($condition)->queryScalar();
     $pages = PageUtil::create($count, $this->getListPageSize());
     $list = Ibos::app()->db->createCommand()->select($field)->from("{{flow_run}} fr")->leftJoin("{{flow_type}} ft", "fr.flowid = ft.flowid")->where($condition)->order("fr.runid DESC")->limit($pages->getLimit())->offset($pages->getOffset())->queryAll();
     foreach ($list as &$rec) {
         if (!empty($rec["attachmentid"])) {
             $rec["attachdata"] = AttachUtil::getAttachData($rec["attachmentid"]);
         }
         $rec["focus"] = StringUtil::findIn($this->uid, $rec["focususer"]);
         $rec["user"] = User::model()->fetchByUid($rec["beginuser"]);
         $rec["key"] = WfCommonUtil::param(array("flowid" => $rec["flowid"], "runid" => $rec["runid"]));
         $rec["begin"] = ConvertUtil::formatDate($rec["begintime"], "n月j日 H:i");
     }
     return array("list" => $list, "pages" => $pages, "advanceOpt" => $isManager || Ibos::app()->user->isadministrator == 1);
 }
示例#29
0
 public function actionManager()
 {
     $data = array();
     $type = EnvUtil::getRequest("type");
     $inSearch = false;
     if ($type == "search") {
         $inSearch = true;
         $condition = "1";
         $keyword = EnvUtil::getRequest("keyword");
         if (!empty($keyword)) {
             $keyword = StringUtil::filterCleanHtml($keyword);
             $condition .= " AND content LIKE '%{$keyword}%'";
         }
         $searchType = EnvUtil::getRequest("searchtype");
         if (!empty($searchType)) {
             $returnStatus = array();
             if (StringUtil::findIn($searchType, 1)) {
                 $returnStatus[] = 1;
             }
             if (StringUtil::findIn($searchType, 0)) {
                 $returnStatus[] = 0;
             }
             $condition .= sprintf(" AND return IN ('%s')", implode(",", $returnStatus));
         }
         $begin = EnvUtil::getRequest("begin");
         $end = EnvUtil::getRequest("end");
         if (!empty($begin) && !empty($end)) {
             $condition .= sprintf(" AND ctime BETWEEN %d AND %d", strtotime($begin), strtotime($end));
         } elseif (!empty($begin)) {
             $condition .= sprintf(" AND ctime > %d", strtotime($begin));
         } elseif (!empty($end)) {
             $condition .= sprintf(" AND ctime < %d", strtotime($end));
         }
         $sender = EnvUtil::getRequest("sender");
         if (!empty($sender)) {
             $realSender = implode(",", StringUtil::getId($sender));
             $condition .= sprintf(" AND uid = %d", intval($realSender));
         }
         $recNumber = EnvUtil::getRequest("recnumber");
         if (!empty($recNumber)) {
             $condition .= sprintf(" AND mobile = %d", sprintf("%d", $recNumber));
         }
         $content = EnvUtil::getRequest("content");
         if (!empty($content) && empty($keyword)) {
             $content = StringUtil::filterCleanHtml($content);
             $condition .= " AND content LIKE '%{$content}%'";
         }
         $type = "manager";
     } else {
         $condition = "";
     }
     $count = NotifySms::model()->count($condition);
     $pages = PageUtil::create($count, 20);
     if ($inSearch) {
         $pages->params = array("keyword" => $keyword, "searchtype" => $searchType, "begin" => $begin, "end" => $end, "sender" => $sender, "recnumber" => $recNumber, "content" => $content);
     }
     $data["list"] = NotifySms::model()->fetchAll(array("condition" => $condition, "order" => "ctime DESC"));
     $data["count"] = $count;
     $data["pages"] = $pages;
     $data["search"] = $inSearch;
     $this->render("manager", $data);
 }