public function archive() { $yy = $this->input->getInt('yy'); $mm = $this->input->getInt('mm'); $date = Factory::getDate("{$yy}-{$mm}-01", Date::tyJalali); $x = $this->respond->archiveStart = $date->toMySQL(); $this->respond->archiveEnd = $date->endOfMonth()->toMySQL(); $this->loadTemplate('archive'); }
public function ShowRequest() { Factory::getUser()->authorise("request", ResponseRegistery::getInstance()->site_id); $this->tmpl->loadPage('showRequest'); $site_id = ResponseRegistery::getInstance()->site_id; $query = "SELECT items.title AS item_name, \n items.price AS item_price,\n reqs.name AS name,\n reqs.tel AS tel,\n reqs.register_date AS date,\n reqs.code AS code,\n reqs.city AS city,\n reqs.address AS address,\n reqs.status AS status,\n reqs.id AS id\n FROM sh_requests AS reqs\n JOIN sh_items_requests AS it_reqs ON (it_reqs.request_id = reqs.id)\n JOIN sh_items AS items ON (items.id = it_reqs.item_id)\n JOIN sh_subgroups_items AS sgItem ON ( sgItem.item_id = items.id )\n JOIN sh_subgroups AS sg ON ( sg.id = sgItem.subgroup_id )\n JOIN sh_groups AS g ON ( sg.group_id = g.id )\n WHERE (g.site_id ={$site_id})"; $res = $this->db->query($query); $retC = QueryResult::$returnClass; QueryResult::$returnClass = 'stdClass'; $requests = $res->fetchAll(); QueryResult::$returnClass = $retC; fb($requests); $ret = array(); foreach ($requests as $req) { fb($req, 'b'); $req->date = Factory::getDate($req->date)->format("d-m-Y"); if (!isset($ret[$req->id])) { $ret[$req->id] = clone $req; //$ret[$req->id]->requests=array(); } $x = $ret[$req->id]; $x->requests[] = clone $req; fb($req, 'a'); } foreach ($ret as &$req) { foreach ($req->requests as &$item) { $item = new istdClass($item); } $req = new istdClass($req); } fb($ret, 'ffffff'); $status_options = array('pending' => 'در دست بررسی', 'sent' => 'ارسال شده', 'cancel' => 'لغو شده', 'return' => 'برگشت خورده'); $this->tmpl->assign('status_options', $status_options); $this->tmpl->assign('requests', $ret); $this->reponse->setTitle('سفارشات'); $this->reponse->setTemplate($this->tmpl); }
private function loadArchive() { $mname = array("", "فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند"); $sql = 'SELECT date FROM wb_articles WHERE weblog_id=' . ResponseRegistery::getInstance()->weblog_id . ' ORDER BY date ASC LIMIT 1'; $date = Factory::getDate($this->db->query($sql)->fetch()->date); $mm = intval($date->format("m")); $yy = intval($date->format("y")); $now = Factory::getDate(); $em = intval($now->format("m")); $ey = intval($now->format("y")); //fb(array($em,$ey)); for (;;) { $ob = new istdClass(); $ob->archivetitle = $mname[$mm]; $ob->archivelink = "archive/{$yy}/{$mm}"; $this->data['blogarchive'][] = $ob; if ($mm == $em && ($yy = $ey)) { break; } if (++$mm == 13) { $mm = 1; $yy++; } } }
/** * Save comment * * @param integer $itemid * @param string $tbl * @param string $comment * @param integer $by * @param integer $parent_activity * @param integer $admin * @return integer (comment id) or false */ public function addComment($itemid = NULL, $tbl = '', $comment = '', $by = 0, $parent_activity = 0, $admin = 0) { if (!$itemid || !$tbl || !$by || !$comment || !$parent_activity) { return false; } $comment = \Hubzero\Utility\String::truncate($comment, 250); $comment = \Hubzero\Utility\Sanitize::stripAll($comment); $this->itemid = $itemid; $this->tbl = $tbl; $this->parent_activity = $parent_activity; $this->comment = $comment; $this->admin = $admin; $this->created = \Factory::getDate()->toSql(); $this->created_by = $by; if (!$this->store()) { return false; } else { return $this->id; } }
public function oldpost() { Factory::getUser()->authorise("post", ResponseRegistery::getInstance()->site_id); $weblog_id = Session::getInstance()->weblog_id; $recordStartNumber = ($this->pagenumber - 1) * 20; //FIXME check here I remove a "+1" that I don't khnow why we write it //pagination vars $pg = $this->tmpl->initPagination(); $start = $pg->getCurrentIndex(); $limit = $pg->getLimit(); if ($this->input->getString('search')) { $search = $this->db->getEscaped($this->input->getString('search')); $where = " and title LIKE '%{$search}%' "; } $query = "SELECT id, title, date, (SELECT COUNT(*)\n \t\tFROM wb_comment WHERE wb_comment.article_id = \n \t\twb_articles.id) AS NumberComment FROM wb_articles \n \t\tWHERE weblog_id ={$weblog_id} " . $where . "ORDER BY date DESC"; $lsql = " LIMIT {$start}, {$limit}"; $pg->setTotal($this->db->query($query)->count()); $articles = $this->db->query($query . $lsql)->fetchAll(); foreach ($articles as $article) { $article->date = Factory::getDate($article->date)->format("Y-m-d"); } $archive_opt = array(); $this->tmpl->loadPage("oldpost"); $this->tmpl->assign("articles", $articles); $this->tmpl->assign("archive_opt", $archive_opt); $this->reponse->setTitle('مدیریت مطالب قبل'); $this->reponse->setTemplate($this->tmpl); }