コード例 #1
0
ファイル: ListController.php プロジェクト: AxelPanda/ibos
 public function actionSearch()
 {
     $condition = array();
     if (Yii::app()->request->getIsPostRequest()) {
         $search = $_POST["search"];
         $condition = EmailUtil::mergeSearchCondition($search, $this->uid);
         $conditionStr = base64_encode(serialize($condition));
     } else {
         $conditionStr = EnvUtil::getRequest("condition");
         $condition = unserialize(base64_decode($conditionStr));
     }
     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, $this->getListPageSize(), 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"]) : "";
     }
     $data = array("list" => $list, "pages" => $pages, "condition" => $conditionStr, "folders" => $this->folders);
     $this->setPageTitle(Ibos::lang("Search result"));
     $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("Search result"))));
     $this->render("search", $data);
 }
コード例 #2
0
ファイル: MailController.php プロジェクト: AxelPanda/ibos
 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");
 }