/** * onLoad */ public function onLoad() { parent::onLoad(); $chld = array(); $chd = array(); $sql = <<<SQL SELECT \t`country`.`id`, \t`country`.`code`, \tCOUNT(`country`.`id`) AS `count` FROM \t{$this->registry['table.user_account']} `account` INNER JOIN \t{$this->registry['table.country']} `country` \tON `account`.`countryId` = `country`.`id` GROUP BY \t`account`.`countryId` ORDER BY \t`account`.`id` ASC SQL; $result = $this->getSql()->getAll($sql); foreach ($result as $row) { if ($row['id'] > 1) { $chld[] = $row['code']; $chd[] = $row['count']; } } $params = array('cht' => 't', 'chs' => '260x140', 'chtm' => 'world', 'chld' => implode('', $chld), 'chd' => 't:' . implode(',', $chd), 'chco' => 'CCCCCC,002200,00EE00'); $this->display($params); }
/** * onLoad */ public function onLoad() { parent::onLoad(); // get action url $url = $this->registry->getUrlByType('http://ns.amun-project.org/2013/amun/service/search'); $this->display($url); }
/** * onLoad * * @param pageId integer */ public function onLoad() { parent::onLoad(); $pageId = $this->args->get('pageId', 0); // get news archive $con = ''; if (!empty($pageId)) { $con = 'WHERE `page`.`id` = ' . $pageId; } $sql = <<<SQL SELECT \t`news`.`id` AS `newsId`, \tCOUNT(`news`.`id`) AS `newsCount`, \tMONTHNAME(`news`.`date`) AS `newsMonthname`, \tDATE_FORMAT(`news`.`date`, '%m') AS `newsMonth`, \tYEAR(`news`.`date`) AS `newsYear`, \t`page`.`path` AS `pagePath` FROM \t{$this->registry['table.news']} `news` INNER JOIN \t{$this->registry['table.content_page']} `page` \tON `news`.`pageId` = `page`.`id` {$con} GROUP BY \t`newsMonth` ORDER BY \t`news`.`date` DESC SQL; $result = $this->getSql()->getAll($sql); $this->display($result); }
/** * onLoad * * @param count integer */ public function onLoad() { parent::onLoad(); $count = $this->args->get('count', 10); // get latest user $handler = $this->hm->getHandler('AmunService\\User\\Account'); $result = $handler->getAll(array('id', 'name', 'thumbnailUrl', 'profileUrl', 'date'), 0, $count, 'id', Sql::SORT_DESC, null, Sql::FETCH_OBJECT); $this->display($result); }
/** * onLoad * * @param pageId integer * @param tabs boolean */ public function onLoad() { parent::onLoad(); $pageId = $this->args->get('pageId', 1); $tabs = $this->args->get('tabs', false); // get pages $result = $this->hm->getTable('AmunService\\Content\\Page')->select(array('id', 'rightId', 'urlTitle', 'title', 'path'))->where('parentId', '=', $pageId)->where('status', '=', Page\Record::NORMAL)->orderBy('sort', Sql::SORT_ASC)->getAll(); $this->display($result, $tabs); }
/** * onLoad * * @param count integer */ public function onLoad() { parent::onLoad(); $count = $this->args->get('count', 8); // condition $con = new Condition(array('scope', '=', 0)); // get activities $handler = $this->hm->getHandler('AmunService\\User\\Activity'); $result = $handler->getAll(array('id', 'scope', 'summary', 'date', 'authorId', 'authorName', 'authorThumbnailUrl'), 0, $count, 'date', Sql::SORT_DESC, $con); $this->display($result); }
/** * onLoad * * @param pageId integer * @param count integer */ public function onLoad() { parent::onLoad(); $pageId = $this->args->get('pageId', 0); $count = $this->args->get('count', 8); // condition $con = null; if (!empty($pageId)) { $con = new Condition(array('pageId', '=', $pageId)); } // get latest news $handler = $this->hm->getHandler('AmunService\\News'); $result = $handler->getAll(array('id', 'urlTitle', 'title', 'date', 'authorId', 'authorName', 'authorProfileUrl', 'pagePath'), 0, $count, 'date', Sql::SORT_DESC, $con, Sql::FETCH_OBJECT); $this->display($result); }
/** * onLoad * * @param pageId integer * @param count integer */ public function onLoad() { parent::onLoad(); $pageId = $this->args->get('pageId', 0); $count = $this->args->get('count', 8); // add css $this->htmlCss->add('forum'); // get latest thread $select = $this->hm->getTable('AmunService\\Forum')->select(array('id', 'urlTitle', 'title', 'date'))->join(Join::INNER, $this->hm->getTable('AmunService\\User\\Account')->select(array('id', 'name', 'profileUrl'), 'author'))->join(Join::INNER, $this->hm->getTable('AmunService\\Content\\Page')->select(array('path'), 'page')); if (!empty($pageId)) { $select->where('pageId', '=', $pageId); } $result = $select->orderBy('date', Sql::SORT_DESC)->limit($count)->getAll(Sql::FETCH_OBJECT); $this->display($result); }
/** * onLoad * * @param count integer */ public function onLoad() { parent::onLoad(); $count = $this->args->get('count', 8); $now = new DateTime('NOW', $this->registry['core.default_timezone']); $past = new DateTime('NOW', $this->registry['core.default_timezone']); $past->sub(new DateInterval('P' . $count . 'D')); $act = array(); // condition $con = new Condition(); $con->add('scope', '=', 0); $con->add('date', '>=', $past->format(DateTime::SQL)); // get activities $handler = $this->hm->getHandler('AmunService\\User\\Activity'); $result = $handler->getAll(array('id', 'scope', 'summary', 'date', 'authorId', 'authorName', 'authorThumbnailUrl'), 0, 64, 'date', Sql::SORT_ASC, $con); foreach ($result as $row) { $date = new DateTime($row['date'], $this->registry['core.default_timezone']); $interval = $date->diff($now); $key = $interval->format('%d'); if (!isset($act[$key])) { $act[$key] = 1; } else { $act[$key]++; } } // build params $chd = array(); $labels = array(); $max = 0; $days = 0; for ($i = $count - 1; $i >= 0; $i--) { if (isset($act[$i])) { if ($act[$i] > $max) { $max = $act[$i]; } $chd[$i] = $act[$i]; } else { $chd[$i] = 0; } $labels[] = date('d M', time() - $i * 3600 * 24); $days++; } $params = array('cht' => 'ls', 'chd' => 't:' . implode(',', $chd), 'chs' => '320x100', 'chco' => '0077CC', 'chds' => '0,' . $max, 'chxt' => 'x', 'chxl' => '0:|' . implode('|', $labels), 'chxr' => '0,1,' . $days . ',1'); $this->display($params); }