public function testContext() { $context = new Context(); $this->assertEquals(null, $context->get('foo')); $this->assertFalse($context->has('foo')); $context->set('foo', 'bar'); $this->assertEquals('bar', $context->get('foo')); $this->assertTrue($context->has('foo')); }
public static function rpc_get_default(Context $ctx) { $user = Node::load(array('class' => 'user', 'deleted' => 0, 'published' => 1, 'id' => $ctx->get('id')), $ctx->db); $email = $user ? $user->email : '*****@*****.**'; $gurl = 'http://www.gravatar.com/avatar/' . md5($email); if (null !== ($s = $ctx->get('s'))) { $gurl .= '?s=' . intval($s) . '&r=x'; } return new Redirect($gurl); }
public static function rpc_change(Context $ctx) { if (null === ($id = $ctx->get('id'))) { throw new RuntimeException(t('Не указан id товара.')); } $cart = new Cart($ctx); $items = $cart->getItems(); $items[$id] = $ctx->get('qty', 1); $cart->setItems($items); return $ctx->getRedirect(); }
/** * Возвращает результаты по опросу. */ public static function on_get_results(Context $ctx) { $output = ''; $id = $ctx->get('id'); $data = $ctx->db->getResultsKV("option", "count", "SELECT `option`, COUNT(*) AS `count` FROM `node__poll` WHERE `nid` = ? GROUP BY `option`", array($ctx->get('id'))); foreach ($data as $k => $v) { $output .= html::em('option', array('count' => $v), html::cdata($k)); } $voted = $ctx->user->id ? $ctx->db->fetch("SELECT COUNT(*) FROM `node__poll` WHERE `nid` = ? AND `uid` = ?", array($id, $ctx->user->id)) : $ctx->db->fetch("SELECT COUNT(*) FROM `node__poll` WHERE `nid` = ? AND `ip` = ?", array($id, $_SERVER['REMOTE_ADDR'])); return new Response(html::em('results', array('voted' => (bool) $voted), $output), 'text/xml'); }
public function test_context() { $c = new Context(array('a' => 1, 'b' => 'xyzzy')); $this->assertEquals($c['a'], 1); $this->assertEquals($c->push(), array()); $c['a'] = 2; $this->assertEquals($c['a'], 2); $this->assertEquals($c->get('a'), 2); $this->assertEquals($c->pop(), array('a' => 2)); $this->assertEquals($c['a'], 1); $this->assertEquals($c->get('foo', 42), 42); }
public static function hookRemoteCall(Context $ctx) { if (null !== $ctx->get('source') and null !== $ctx->get('search')) { $output = array(); $parts = explode('.', $ctx->get('source'), 2); foreach (Node::find($ctx->db, $filter = array('class' => $parts[0], $parts[1] => '%' . $ctx->get('search') . '%'), 10) as $n) { $output[$n->id] = isset($n->{$parts}[1]) ? $n->{$parts}[1] : $n->name; } $output = join("\n", array_values($output)); return new Response($output, 'text/plain'); } }
public static function rpc_get_restore(Context $ctx) { $node = Node::load(array('class' => 'user', 'name' => $ctx->get('email'), 'deleted' => 0, 'published' => 1)); if ($ctx->get('otp') != $node->otp) { throw new ForbiddenException(t('Эта ссылка устарела.')); } $ctx->db->beginTransaction(); unset($node->otp); $node->save(); $ctx->db->commit(); $ctx->user->login($node->name, null, true); Logger::log($node->name . ' logged in using OTP.', 'auth'); }
/** * Вывод списка файлов. */ public static function on_get_list(Context $ctx) { try { $options = array('#raw' => true, 'name' => 'list', 'title' => t('Файловый архив'), 'path' => os::webpath(MCMS_SITE_FOLDER, $ctx->config->get('modules/files/storage')), 'advsearch' => true, 'canedit' => true, 'mode' => $ctx->get('mode', 'table'), 'scope' => $ctx->get('scope'), 'type' => 'file'); $tmp = new FileList($ctx, $options['scope']); return $tmp->getHTML('files', $options); } catch (TableNotFoundException $e) { if ($e->getTableName() != 'node__idx_filetype') { throw $e; } throw new Exception(t('Отсутствует индекс по полю filetype, <a href="@url">исправьте это</a> и возвращайтесь.', array('@url' => 'admin/structure/fields/edit?type=file&field=filetype&destination=' . urlencode(MCMS_REQUEST_URI)))); } }
/** * * @param type Model_Page_Front */ private function _render(Model_Page_Front $page) { View::set_global('page_object', $page); View::set_global('page', $page); $this->_ctx->set_page($page); // If page needs login, redirect to login if ($page->needs_login() == Model_Page::LOGIN_REQUIRED) { Observer::notify('frontpage_login_required', $page); if (!Auth::is_logged_in()) { Flash::set('redirect', $page->url()); $this->redirect(Route::get('user')->uri(array('action' => 'login'))); } } Observer::notify('frontpage_found', $page); $this->_ctx->set_crumbs($page); $this->_ctx->build_crumbs(); // Если установлен статус 404, то выводим страницу 404 // Страницу 404 могут выкидывать также Виджеты if (Request::current()->is_initial() and $this->response->status() == 404) { $message = $this->_ctx->get('throw_message'); $this->_ctx = NULL; if (!$message) { $message = 'Page not found'; } Model_Page_Front::not_found($message); } $html = (string) $page->render_layout(); // Если пользователь Администраторо или девелопер, в конец шаблона // добавляем View 'system/blocks/toolbar', в котором можно добавлять // собственный HTML, например панель администратора if (Auth::is_logged_in() and Auth::has_permissions(array('administrator', 'developer'))) { $inject_html = (string) View::factory('system/blocks/toolbar'); // Insert system HTML before closed tag body $matches = preg_split('/(<\\/body>)/i', $html, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); if (count($matches) > 1) { /* assemble the HTML output back with the iframe code in it */ $html = $matches[0] . $inject_html . $matches[1] . $matches[2]; } } // Если в наcтройках выключен режим отладки, то выключить etag кеширование if (Config::get('site', 'debug') == Config::NO) { $this->check_cache(sha1($html)); $this->response->headers('last-modified', date('r', strtotime($page->updated_on))); } $this->response->headers('Content-Type', $page->mime()); if (Config::get('global', 'x_powered_header') == Config::YES) { $this->response->headers('X-Powered-CMS', CMS_NAME . '/' . CMS_VERSION); } $this->response->body($html); }
public static function rpc_get(Context $ctx) { $host = null; if ($tmp = $ctx->get('host')) { $host = $tmp; } elseif ($tmp = $ctx->get('url')) { $url = new url($tmp); $host = $url->host; } if (null === $host) { throw new InvalidArgumentException(t('Имя сервера нужно указать в параметре host или url.')); } $next = 'http://www.google.com/s2/favicons?domain=' . urlencode($host); $ctx->redirect($next); }
public static function on_get_custom(Context $ctx) { $filter = array(); if (!($filter['class'] = $ctx->get('type'))) { $filter['class'] = $ctx->db->getResultsV("name", "SELECT name FROM node WHERE class = 'type' AND deleted = 0 AND published = 1"); } if ($tmp = $ctx->get('tags')) { $filter['tags'] = explode('+', $tmp); } if ($tmp = $ctx->get('author')) { $filter['uid'] = $tmp; } $feed = new RSSFeed($filter); return $feed->render($ctx); }
protected static function rpc_get_remove(Context $ctx) { $name = $ctx->get('name'); try { $node = Node::load(array('class' => 'subscription', 'name' => $name, 'deleted' => 0, 'published' => 1)); if (empty($node) or $node->id != $ctx->get('id')) { throw new PageNotFoundException(); } $ctx->db->beginTransaction(); $node->delete(); $ctx->db->commit(); } catch (ObjectNotFoundException $e) { } return $ctx->getRedirect('?unsubscribed=' . urlencode($name)); }
public static function on_find_xml(Context $ctx) { if (null === ($search = $ctx->get('search'))) { throw new BadRequestException(t('Не указана подстрока для поиска (GET-параметр search).')); } if (!($limit = intval($ctx->get('limit', 5)))) { throw new BadRequestException(t('Не указано количество возовращаемых меток (GET-параметр limit).')); } list($sql, $params) = Query::build(array('class' => 'label', 'deleted' => 0, 'published' => 1, 'name?|' => '%' . $search . '%', '#sort' => 'name'))->getSelect(null, null, 'name'); $result = ''; foreach ((array) $ctx->db->getResultsV("name", $sql, $params) as $name) { $result .= html::em('label', html::cdata($name)); } return new Response(html::em('labels', array('search' => $search, 'limit' => $limit), $result), 'text/xml'); }
function dispSocialxeAdminBitly() { // 설정 정보를 받아옴 Context::set('config', $this->config); // bit.ly 설정이 되어 있지 않으면 환경설정으로 보낸다. if (!$this->config->bitly_username || !$this->config->bitly_api_key) { header('Location: ' . getNotEncodedUrl('act', 'dispSocialxeAdminConfig')); return; } // 목록을 구하기 위한 옵션 $args->page = Context::get('page'); $args->title = Context::get('title'); $output = executeQueryArray('socialxe.getBitlyPageList', $args); if (!$output->toBool()) { return $output; } // 템플릿에 쓰기 위해서 comment_model::getTotalCommentList() 의 return object에 있는 값들을 세팅 Context::set('total_count', $output->total_count); Context::set('total_page', $output->total_page); Context::set('page', $output->page); Context::set('bitly_list', $output->data); Context::set('page_navigation', $output->page_navigation); // 템플릿 파일 지정 $this->setTemplatePath($this->module_path . 'tpl'); $this->setTemplateFile('bitly_index'); }
function getNickChangeList($obj) { $args->s_member_srl = $obj->member_srl; $args->page = Context::get('page'); // /< Page $args->list_count = 20; // /< the number of posts to display on a single page $args->page_count = 10; // /< the number of pages that appear in the page navigation $args->sort_index = 'regdate'; // /< sorting values $args->order_type = 'desc'; // /< sorting values by order if ($obj->search_target == 'nick_name') { $args->nick_name_old = $obj->search_keyword; $args->nick_name_new = $obj->search_keyword; } if ($obj->search_target == 'member_srl') { $args->s_member_srl = $obj->search_keyword; } if ($obj->search_target == 'user_id') { $oMemberModel =& getModel('member'); $member_info = $oMemberModel->getMemberInfoByUserID($obj->search_keyword); $args->s_member_srl = $member_info->member_srl; } $output = executeQueryArray('sejin7940_nick.getNickChangeList', $args); return $output; }
function dispSocialxeserverModifyClient() { if (!$this->grant->register) { return $this->stop('msg_not_permitted'); } $client_srl = Context::get('client_srl'); if (!$client_srl) { return $this->stop('msg_invalid_request'); } // 클라이언트 정보 얻기 $args->client_srl = $client_srl; $output = executeQuery('socialxeserver.getClient', $args); if (!$output->toBool()) { return $output; } if (!$output->data) { return $this->stop('msg_invalid_request'); } // 본인의 클라이언트인지 다시 한번 더 확인 $logged_info = Context::get('logged_info'); if ($output->data->member_srl != $logged_info->member_srl) { return $this->stop('msg_not_permitted'); } // 정보 가공 $client_info = $output->data; $domain_array = explode(',', $client_info->domain); foreach ($domain_array as $name => $val) { $domain_array[$name] = trim($val); } // 템플릿에 사용하기 위해 셋 Context::set('client_info', $client_info); Context::set('domain_list', $domain_array); $this->setTemplateFile('modify_client'); }
/** * Report an improper comment * @return void */ function dispCommentDeclare() { $this->setLayoutFile('popup_layout'); $comment_srl = Context::get('target_srl'); $oMemberModel = getModel('member'); // A message appears if the user is not logged-in if (!$oMemberModel->isLogged()) { return $this->stop('msg_not_logged'); } // Create the comment object. $oCommentModel = getModel('comment'); // Creates an object for displaying the selected comment $oComment = $oCommentModel->getComment($comment_srl); if (!$oComment->isExists()) { return new Object(-1, 'msg_invalid_request'); } // Check permissions if (!$oComment->isAccessible()) { return new Object(-1, 'msg_not_permitted'); } // Browser title settings Context::set('target_comment', $oComment); Context::set('target_srl', $comment_srl); $this->setTemplatePath($this->module_path . 'tpl'); $this->setTemplateFile('declare_comment'); }
function triggerDisplay() { //trigger display before(); if (strpos(Context::get('act'), "ispBoardAdmin") || strpos(Context::get('act'), "ispBoard_extendAdmin")) { $core_ver = __XE_VERSION__ ? __XE_VERSION__ : __ZBXE_VERSION__; $is_active = Context::get('act') == 'dispBoard_extendAdminBoardModify' ? true : false; $url = getNotEncodedUrl('act', 'dispBoard_extendAdminBoardModify', 'selected_var_idx', '', 'type', ''); $text = "목록수정"; if ($core_ver >= 1.7) { $active = $is_active ? "class='x_active'" : ""; $html = sprintf("<li %s><a href='%s'>%s</a></li>", $active, $url, $text); $script = "jQuery(document).ready(function(\$){\$('.x_nav').append(\"{$html}\");});"; } else { if ($core_ver >= 1.5) { $active = $is_active ? "class='active'" : ""; $html = sprintf("<li %s><a href='%s'>%s</a></li>", $active, $url, $text); $script = "jQuery(document).ready(function(\$){\$('.x .cnb ul').append(\"{$html}\");});"; } else { if ($core_ver >= 1.4) { $active = $is_active ? "class='on'" : ""; $html = sprintf("<li %s><a href='%s'>%s</a></li>", $active, $url, $text); $script = "jQuery(document).ready(function(\$){\$('#xeAdmin .header4 .localNavigation').append(\"{$html}\");});"; } else { $this->stop('지원하지 않는 버전입니다. board_extend 모듈을 제거해주시기 바랍니다.'); } } } Context::addHtmlHeader("<script type='text/javascript'>{$script}</script>"); } }
/** * @brief 서비스형 모듈의 추가 설정을 위한 부분 * file의 사용 형태에 대한 설정만 받음 **/ function triggerDispFileAdditionSetup(&$obj) { $current_module_srl = Context::get('module_srl'); $current_module_srls = Context::get('module_srls'); if (!$current_module_srl && !$current_module_srls) { // 선택된 모듈의 정보를 가져옴 $current_module_info = Context::get('current_module_info'); $current_module_srl = $current_module_info->module_srl; if (!$current_module_srl) { return new Object(); } } // 선택된 모듈의 file설정을 가져옴 $oFileModel =& getModel('file'); $file_config = $oFileModel->getFileModuleConfig($current_module_srl); Context::set('file_config', $file_config); // 그룹의 설정을 위한 권한 가져오기 $oMemberModel =& getModel('member'); $site_module_info = Context::get('site_module_info'); $group_list = $oMemberModel->getGroups($site_module_info->site_srl); Context::set('group_list', $group_list); // 템플릿 파일 지정 $oTemplate =& TemplateHandler::getInstance(); $tpl = $oTemplate->compile($this->module_path . 'tpl', 'file_module_config'); $obj .= $tpl; return new Object(); }
/** * @brief 모듈 목록 */ function dispInipaystandardAdminModuleList() { $args = new stdClass(); $args->sort_index = "module_srl"; $args->page = Context::get('page'); $args->list_count = 20; $args->page_count = 10; $args->s_module_category_srl = Context::get('module_category_srl'); $search_target = Context::get('search_target'); $search_keyword = Context::get('search_keyword'); switch ($search_target) { case 'mid': $args->s_mid = $search_keyword; break; case 'browser_title': $args->s_browser_title = $search_keyword; break; } $output = executeQueryArray('inipaystandard.getModuleList', $args); ModuleModel::syncModuleToSite($output->data); Context::set('total_count', $output->total_count); Context::set('total_page', $output->total_page); Context::set('page', $output->page); Context::set('module_list', $output->data); Context::set('page_navigation', $output->page_navigation); $this->setTemplateFile('module_list'); }
/** * Check whether to use RSS rss url by adding * * @return Object */ function triggerRssUrlInsert() { $oModuleModel = getModel('module'); $total_config = $oModuleModel->getModuleConfig('rss'); $current_module_srl = Context::get('module_srl'); $site_module_info = Context::get('site_module_info'); if (is_array($current_module_srl)) { unset($current_module_srl); } if (!$current_module_srl) { $current_module_info = Context::get('current_module_info'); $current_module_srl = $current_module_info->module_srl; } if (!$current_module_srl) { return new Object(); } // Imported rss settings of the selected module $oRssModel = getModel('rss'); $rss_config = $oRssModel->getRssModuleConfig($current_module_srl); if ($rss_config->open_rss != 'N') { Context::set('rss_url', $oRssModel->getModuleFeedUrl(Context::get('vid'), Context::get('mid'), 'rss')); Context::set('atom_url', $oRssModel->getModuleFeedUrl(Context::get('vid'), Context::get('mid'), 'atom')); } if (Context::isInstalled() && $site_module_info->mid == Context::get('mid') && $total_config->use_total_feed != 'N') { if (Context::isAllowRewrite() && !Context::get('vid')) { $request_uri = Context::getRequestUri(); Context::set('general_rss_url', $request_uri . 'rss'); Context::set('general_atom_url', $request_uri . 'atom'); } else { Context::set('general_rss_url', getUrl('', 'module', 'rss', 'act', 'rss')); Context::set('general_atom_url', getUrl('', 'module', 'rss', 'act', 'atom')); } } return new Object(); }
/** * the html to select colorset of the skin * @return void */ function getCommunicationAdminColorset() { $skin = Context::get('skin'); $type = Context::get('type') == 'P' ? 'P' : 'M'; Context::set('type', $type); if ($type == 'P') { $dir = 'skins'; } else { $dir = 'm.skins'; } if (!$skin) { $tpl = ""; } else { $oModuleModel = getModel('module'); $skin_info = $oModuleModel->loadSkinInfo($this->module_path, $skin, $dir); Context::set('skin_info', $skin_info); $oModuleModel = getModel('module'); $communication_config = $oModuleModel->getModuleConfig('communication'); if (!$communication_config->colorset) { $communication_config->colorset = "white"; } Context::set('communication_config', $communication_config); $security = new Security(); $security->encodeHTML('skin_info.colorset..title', 'skin_info.colorset..name'); $security->encodeHTML('skin_info.colorset..name'); $oTemplate = TemplateHandler::getInstance(); $tpl = $oTemplate->compile($this->module_path . 'tpl', 'colorset_list'); } $this->add('tpl', $tpl); $this->add('type', $type); }
/** * Counter logs * * @return void **/ function counterExecute() { $oDB =& DB::getInstance(); $oDB->begin(); $site_module_info = Context::get('site_module_info'); $site_srl = (int) $site_module_info->site_srl; // Check the logs $oCounterModel =& getModel('counter'); // Register today's row if not exist if (!$oCounterModel->isInsertedTodayStatus($site_srl)) { $this->insertTodayStatus(0, $site_srl); // check user if the previous row exists } else { // If unregistered IP if (!$oCounterModel->isLogged($site_srl)) { // Leave logs $this->insertLog($site_srl); // Register unique and pageview $this->insertUniqueVisitor($site_srl); } else { // Register pageview $this->insertPageView($site_srl); } } $oDB->commit(); }
function dispSocialxeserverAdminModifyClient() { $client_srl = Context::get('client_srl'); if (!$client_srl) { return $this->stop('msg_invalid_request'); } // 클라이언트 정보 얻기 $args->client_srl = $client_srl; $output = executeQuery('socialxeserver.getClient', $args); if (!$output->toBool()) { return $output; } if (!$output->data) { return $this->stop('msg_invalid_request'); } // 정보 가공 $client_info = $output->data; $domain_array = explode(',', $client_info->domain); foreach ($domain_array as $name => $val) { $domain_array[$name] = trim($val); } // 템플릿에 사용하기 위해 셋 Context::set('client_info', $client_info); Context::set('domain_list', $domain_array); // 템플릿 파일 지정 $this->setTemplatePath($this->module_path . 'tpl'); $this->setTemplateFile('modify_client'); }
/** * Skin Settings * * @return Object */ function dispStore_searchAdminSkinInfo() { $oModuleModel = getModel('module'); $module_srl = Context::get('module_srl'); // module_srl이 넘어오면 해당 모듈의 정보를 미리 구해 놓음 if($module_srl) { $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); if(!$module_info) { Context::set('module_srl',''); $this->act = 'list'; } else { $oModuleModel->syncModuleToSite($module_info); $this->module_info = $module_info; Context::set('module_info',$module_info); } } // 공통 모듈 권한 설정 페이지 호출 $oModuleAdminModel = getAdminModel('module'); $skin_content = $oModuleAdminModel->getModuleSkinHTML($this->module_info->module_srl); Context::set('skin_content', $skin_content); $this->setTemplateFile('skininfo'); }
/** * @brief 관리자 페이지 초기화면 **/ function dispCounterAdminIndex() { // 정해진 일자가 없으면 오늘자로 설정 $selected_date = Context::get('selected_date'); if (!$selected_date) { $selected_date = date("Ymd"); } Context::set('selected_date', $selected_date); // counter model 객체 생성 $oCounterModel =& getModel('counter'); // 전체 카운터 및 지정된 일자의 현황 가져오기 $site_module_info = Context::get('site_module_info'); $status = $oCounterModel->getStatus(array(0, $selected_date), $site_module_info->site_srl); Context::set('total_counter', $status[0]); Context::set('selected_day_counter', $status[$selected_date]); // 시간, 일, 월, 년도별로 데이터 가져오기 $type = Context::get('type'); if (!$type) { $type = 'day'; Context::set('type', $type); } $detail_status = $oCounterModel->getHourlyStatus($type, $selected_date, $site_module_info->site_srl); Context::set('detail_status', $detail_status); // 표시 $this->setTemplateFile('index'); }
/** * @brief Button to output **/ function printBtn() { if ($this->nextUrl) { $url = $this->nextUrl; printf('<a href="%s">%s</a><br>%s', $url->url, $url->text, "\n"); } if ($this->prevUrl) { $url = $this->prevUrl; printf('<a href="%s">%s</a><br>%s', $url->url, $url->text, "\n"); } // Select Language if (!parent::isLangChange()) { $url = getUrl('', 'lcm', '1', 'sel_lang', Context::getLangType(), 'return_uri', Context::get('current_url')); printf('<a href="%s">%s</a><br>%s', $url, 'Language : ' . Context::getLang('select_lang'), "\n"); } else { printf('<a href="%s">%s</a><br>%s', Context::get('return_uri'), Context::getLang('lang_return'), "\n"); } if ($this->upperUrl) { $url = $this->upperUrl; printf('<btn href="%s" name="%s">%s', $url->url, $url->text, "\n"); } if ($this->homeUrl) { $url = $this->homeUrl; printf('<a btn="%s" href="%s">%s</a><br>%s', $url->text, $url->url, $url->text, "\n"); } }
/** * Show the blacklist of comments in the admin page * @return void */ function dispCommentAdminDeclared() { // option to get a blacklist $args->page = Context::get('page'); // /< Page $args->list_count = 30; // /< the number of comment postings to appear on a single page $args->page_count = 10; // /< the number of pages to appear on the page navigation $args->sort_index = 'comment_declared.declared_count'; // /< sorting values $args->order_type = 'desc'; // /< sorted value // get a list $declared_output = executeQuery('comment.getDeclaredList', $args); if ($declared_output->data && count($declared_output->data)) { $comment_list = array(); $oCommentModel =& getModel('comment'); foreach ($declared_output->data as $key => $comment) { $comment_list[$key] = new commentItem(); $comment_list[$key]->setAttribute($comment); } $declared_output->data = $comment_list; } // set values in the return object of comment_model:: getCommentList() in order to use a template. Context::set('total_count', $declared_output->total_count); Context::set('total_page', $declared_output->total_page); Context::set('page', $declared_output->page); Context::set('comment_list', $declared_output->data); Context::set('page_navigation', $declared_output->page_navigation); // set the template $this->setTemplatePath($this->module_path . 'tpl'); $this->setTemplateFile('declared_list'); }
/** * Display a form to upload the xml file * @return void */ function dispImporterAdminContent() { $this->setTemplatePath($this->module_path . 'tpl'); $source_type = Context::get('source_type'); switch ($source_type) { case 'member': $template_filename = "member"; break; case 'ttxml': $oModuleModel = getModel('module'); //$mid_list = $oModuleModel->getMidList(); //perhaps mid_list variables not use //Context::set('mid_list', $mid_list); $template_filename = "ttxml"; break; case 'module': $oModuleModel = getModel('module'); //$mid_list = $oModuleModel->getMidList(); //perhaps mid_list variables not use //Context::set('mid_list', $mid_list); $template_filename = "module"; break; case 'message': $template_filename = "message"; break; case 'sync': $template_filename = "sync"; break; default: $template_filename = "index"; break; } $this->setTemplateFile($template_filename); }
/** * 기록한 에러 목록을 표시하는 메소드. */ public function dispErrorLoggerAdminList() { // 현재 설정을 불러온다. Context::set('elconfig', $this->getConfig()); // 에러 목록을 불러온다. $obj = new stdClass(); $elcount = executeQuery('errorlogger.countErrorLog', $obj); $elcount = $elcount->toBool() ? $elcount->data->count : 0; $obj->page = $page = Context::get('page') ? Context::get('page') : 1; $ellog = executeQuery('errorlogger.getErrorLog', $obj); $ellog = $ellog->toBool() ? $ellog->data : array(); Context::set('elcount', $elcount); Context::set('ellog', $ellog); // 페이징을 처리한다. $paging = new Object(); $paging->total_count = $elcount; $paging->total_page = max(1, ceil($elcount / 20)); $paging->page = $page; $paging->page_navigation = new PageHandler($paging->total_count, $paging->total_page, $page, 10); Context::set('paging', $paging); Context::set('page', $page); // 템플릿을 지정한다. $this->setTemplatePath($this->module_path . 'tpl'); $this->setTemplateFile('list'); }