public function __construct() { $this->url = URL::getInstance(); $this->template = Template::getInstance(); $this->request = Request::getInstance(); $this->values = Values::getInstance(); }
public function js() { $row = $this->input->getInt('row'); $col = $this->input->getInt('col'); $uid = $this->input->getInt('uid'); $count = $row * $col; $sql = 'SELECT ads.* FROM ck_ads as ads JOIN ck_packages as pack ON(ads.package_id=pack.id) WHERE ads.status="approve" AND ads.clicked < pack.max_click ORDER BY RAND() LIMIT ' . $count; $query = $this->db->query($sql); $tmpl = Template::getInstance('empty.tpl'); $tmpl->loadPage('jsAds'); fb($col, 'row'); for ($i = 0; $i < $row; ++$i) { $tmp = array(); for ($j = 0; $j < $col; ++$j) { $tmp[] = $query->fetch(); } $data[] = $tmp; } fb($data); $tmpl->assign('uid', $uid); $tmpl->assign('row', $row); $tmpl->assign('col', $col); $tmpl->assign('data', $data); Response::getInstance()->setTemplate($tmpl); }
public function editAction() { //on charge le model de formation $maFormationSession = App::getModel('FormationSession'); //crée la liste des matières via une collection $collection = App::getCollection('Formation'); $collection->select(); $coll_for = $collection->getItems(); if (isset($_GET['id'])) { $maFormationSession->load($_GET['id']); } if (isset($_POST['submit'])) { //Si id existe et n'est pas vide, on modifie if (isset($_POST['id']) && !empty($_POST['id'])) { $maFormationSession->store(array('id' => $_POST['id'])); } else { //sinon c'est une création $maFormationSession->store(array('id' => 0)); } $maFormationSession->store(array('begin_date' => $_POST['begin_date'], 'ending_date' => $_POST['ending_date'], 'formations_id' => $_POST['formations'])); //on appelle la méthode qui stock les infos dans l'objet crée $maFormationSession->save(); //Formation et les réf pedago lié sont crée, on retoure au listing header("Location: index.php?c=FormationSession"); } //On transmet via setDatas() la collection de formation dans un tableau associatif Template::getInstance()->setFileName("FormationSession/edit_formationsession")->setDatas(array('maFormationSession' => $maFormationSession, 'coll_for' => $coll_for))->render(); }
/** +---------------------------------------------------------- * 渲染模板输出 +---------------------------------------------------------- * @access public +---------------------------------------------------------- * @param string $templateFile 模板文件名 * @param array $var 模板变量 +---------------------------------------------------------- * @return void +---------------------------------------------------------- */ public function fetch($templateFile, $_var) { $template_dir = dirname($templateFile) . DIRECTORY_SEPARATOR; vendor('TpcTemplate.template#class'); if (C('TMPL_ENGINE_CONFIG')) { $config = C('TMPL_ENGINE_CONFIG'); $options = array(); foreach ($config as $key => $val) { $options[$key] = $val; } unset($config); } else { $options = array('template_dir' => TMPL_PATH, 'cache_dir' => CACHE_PATH, 'auto_update' => true, 'cache_lifetime' => 0, 'suffix' => '.html'); } if (is_dir($template_dir)) { $options['template_dir'] = $template_dir; } $template = Template::getInstance(); //使用单件模式实例化模板类 $template->setOptions($options); //设置模板参数 unset($template_dir); extract($_var); if (is_file($templateFile)) { include $template->getfile(basename($templateFile, $options['suffix'])); } else { include $template->getfile(basename($template_dir . $templateFile, $options['suffix'])); } }
/** * This method will get a module/action or module template result * * @param array $params * @param Smarty $smarty */ function smarty_function_widget($params, &$smarty) { if (!isset($params['module']) || !isset($params['action']) && !isset($params['template']) || isset($params['action']) && isset($params['template'])) { throw new SmartyException('{widget} : module and action (or template) parameters must be defined'); } $args = array(); if (count($params) > 2) { foreach ($params as $k => $v) { if ($k !== 'module' && $k !== 'action' && $k !== 'template') { $args[$k] = $v; } } } if (isset($params['action'])) { Controller::getInstance()->setModule($params['module'])->setAction($params['action'])->setArgs(array($args))->dispatch(); } else { if ($file = get_module_file($params['module'], 'template/' . $params['template'], true)) { $tpl = Template::getInstance($file); foreach ($smarty->tpl_vars as $k => $v) { if ($k !== 'SCRIPT_NAME' && $k !== 'smarty' && !isset($args[$k])) { $args[$k] = $v->value; } } if (empty($args)) { return $tpl->get(); } foreach ($args as $name => $value) { $tpl->assign($name, $value); } return $tpl->get(); } } }
public function showBan() { Factory::getUser()->authorise("admin", ResponseRegistery::getInstance()->site_id); $db = Factory::getDBO(); if ($search) { $where = " AND blog.title LIKE '%{$search}%' or sub.sub_domain='{$search}' "; } $tmpl = Template::getInstance('adminDashboard.tpl'); $pg = $tmpl->initPagination(); $start = $pg->getCurrentIndex(); $limit = $pg->getLimit(); $sql = 'SELECT blog.title as title, sub.sub_domain, blog.site_id, max(post.`date`)as lastpost, site.active as active FROM wb_weblogs as blog JOIN ge_sites as site ON(blog.site_id=site.id) JOIN ge_subdomains as sub ON(sub.site_id=sub.site_id) left JOIN wb_articles as post ON(post.weblog_id=blog.id) WHERE site.active=0 ' . $where . ' group by blog.site_id LIMIT ' . "{$start},{$limit}"; $list = $db->query($sql)->fetchAll(); $tmpl->loadPage('listblog'); $tmpl->assign('list', $list); $this->reponse->setTitle('لیست وبلاگها'); $this->reponse->setTemplate($tmpl); }
/** * * Systemstatus anzeigen * */ public function showSystemStatus($ErrorString = "", $StatusString = "") { //if(!Controler_Main::getInstance()->isUserLoggedIn())//if( $this->User->getUserLevel() < BACKEND_USERLEVEL ) if (Controler_Main::getInstance()->getUserLevel() < BACKEND_USERLEVEL) { $ControlerStart = new Controler_Start(); $ControlerStart->start(); return false; } $Request = new Request(); /* $SystemInformationFinder= new SystemInformationFinder(); $MySql = $SystemInformationFinder->mysqlVersion(); $MySqlVersion = $MySql[0]['s_MySqlVersion']; */ $PHPVersion = phpversion(); $WebserverVersion = $_SERVER['SERVER_SOFTWARE']; $WebserverVersion = "<div class='befehlskontainer' >" . str_replace(" ", "</div><div class='befehlskontainer' >", $WebserverVersion) . "</div>"; $WebserverConfig = "<div class='befehlskontainer' >:T_SERVER_NAME:: " . $_SERVER['SERVER_NAME'] . "</div><div class='befehlskontainer' >"; $WebserverConfig .= ":T_SERVER_ADDR:: " . $_SERVER['SERVER_ADDR'] . "</div><div class='befehlskontainer' >"; $WebserverConfig .= ":T_SERVER_PORT:: " . $_SERVER['SERVER_PORT'] . "</div><div class='befehlskontainer' >"; $WebserverConfig .= ":T_REMOTE_ADDR:: " . $_SERVER['REMOTE_ADDR'] . "</div><div class='befehlskontainer' >"; $WebserverConfig .= ":T_DOCUMENT_ROOT:: " . $_SERVER['DOCUMENT_ROOT'] . "</div><div class='befehlskontainer' >"; $WebserverConfig .= ":T_SERVER_ADMIN:: " . $_SERVER['SERVER_ADMIN'] . "</div>"; $Template = Template::getInstance("tpl_BE_SystemStatus.php"); $Template->assign("UserId", Controler_Main::getInstance()->getUser()->getId()); $Template->assign("WebserverConfig", $WebserverConfig); $Template->assign("WebserverVersion", $WebserverVersion); $Template->assign("PHPVersion", $PHPVersion); $Template->assign("MySqlVersion", mysql_get_server_info()); $Template->assign("MySqlClientInfo", mysql_get_client_info()); $Template->assign("MySqlProtInfo", mysql_get_proto_info()); $Template->assign("MySqlHostInfo", mysql_get_host_info()); $Template->render(); }
function __construct($model_name, $method = 'post', $action = null) { $this->model_name = $model_name; $this->method = $method; $this->action = $action; $this->schema = new Schema($model_name); $this->template = Template::getInstance(); }
public function generate() { if ($this->inline) { return Template::getInstance()->get('form_panel_inline', $this->getData()); } else { return Template::getInstance()->get('form_panel', $this->getData()); } }
/** * 架构函数 * @access public */ public function __construct() { $this->tagLib = strtolower(substr(get_class($this), 6)); $this->tpl = Template::getInstance(); //ThinkTemplate::getInstance(); $this->_initialize(); $this->load(); }
public function generate() { $content = ''; foreach ($this->content as $menu) { $content .= $menu->generate(); } $data = array('__BLOCK__' => $content); return Template::getInstance()->get('slide', $data, 'org.sygil.slide.block'); }
public function generate() { $style = ''; if ($this->background) { $style .= 'background:' . $this->background . ';'; } $data = array('__ID__' => $this->id, '__CONTENT__' => $this->content, '__STYLE__' => $style); return Template::getInstance()->get('line', $data, 'org.sygil.base.panel'); }
public function generate() { $content = ''; foreach ($this->content as $menu) { $content .= $menu->generate(); } $data = array('__TITLE__' => $this->title, '__CONTENT__' => $content, '__STYLE__' => $this->active ? 'display:block;' : 'display:none;', '__ID__' => $this->id); return Template::getInstance()->get('block', $data, 'org.sygil.menu.block'); }
function aviators_templates_init() { $clear = aviators_settings_get_value('templates', 'cache', 'clear'); $debug = aviators_settings_get_value('templates', 'cache', 'debug'); if ($clear == 'on') { $instance = Template::getInstance(); $instance->clearCacheFiles(); update_option('templates_cache_clear', FALSE); } }
public function showList() { Factory::getUser()->authorise("template", ResponseRegistery::getInstance()->site_id); $db = Factory::getDBO(); $list = $db->SimpleSelect("ge_default_templates", "id,image,name")->fetchAll(); $tmpl = Template::getInstance('userDashboard.tpl'); $tmpl->loadPage('list_template'); $tmpl->assign('list', $list); $this->reponse->setTitle('لیست قالب ها'); $this->reponse->setTemplate($tmpl); }
/** * 获取视图的最终输入 * * @param string $viewFilename 文件名 * @param array $viewData 变量 * @return string * @throws Exception */ protected function capture($viewFilename, array $viewData) { //使用单件模式实例化模板类 $template = Template::getInstance(); $template->setOptions($this->_templateOptions); // 附加模板后缀 $viewFilename .= $this->_templateOptions['template_ext']; // 获取模板解析后的完整路径 $file = $template->getFile($viewFilename); return parent::capture($file, $viewData); }
public function generate() { try { $this->setData('theme', $this->genThemeList()); $this->setData('script', $this->genScriptList()); $this->setData('exec', $this->genExecList()); return Template::getInstance()->get('index', $this->data); } catch (CoreException $exception) { throw new CoreException('Error: Cannot generate Index Page'); } }
/** * mailing_list_filter_menu * * adds the mailing list pane to the admin menu * * @params string $menu * @params string $url * @return string */ function mailing_list_filter_menu($items, $url) { $Template = Template::getInstance(); $menu = array(); foreach ($items as $item => $val) { if ($item == 'menu_users_groups') { $menu['menu_mailing_list'] = array('name' => $Template->e('menu_mailing_list'), 'url' => $url, 'submenu' => array('menu_mailing_list_subscribers' => array('name' => $Template->e('menu_mailing_list_subscribers'), 'url' => $url . 'page=list', 'image' => SITE_URL . '_plugins/Mailing-List/img/list.png'), 'menu_mailing_send_mail' => array('name' => $Template->e('menu_mailing_send_mail'), 'url' => $url . 'page=mail', 'image' => SITE_URL . '_plugins/Mailing-List/img/send.png'), 'menu_mailing_options' => array('name' => $Template->e('menu_mailing_options'), 'url' => $url . 'page=options', 'image' => SITE_URL . '_plugins/Mailing-List/img/options.png'))); } $menu[$item] = $val; } return $menu; }
/** * blog_admin_menu * * adds the blog page to the admin menu * * @params array $menu * @params string $url * @return array */ function blog_admin_menu($items, $url) { $Template = Template::getInstance(); $menu = array(); foreach ($items as $item => $val) { if ($item == 'menu_users_groups') { $menu['menu_blog'] = array('name' => $Template->e('menu_blog'), 'url' => $url); } $menu[$item] = $val; } return $menu; }
public function generate() { $content = ''; if (is_array($this->content)) { foreach ($this->content as $line) { $content .= $line->generate(); } } else { $content = $this->content; } $data = array('__ID__' => $this->id, '__CONTENT__' => $content, '__STYLE__' => $this->getCss()); return Template::getInstance()->get('panel', $data, 'org.sygil.base.panel'); }
public function generateDaily() { $content = ''; $this->getEvent(); foreach ($this->event as $event) { $data = array('__TITLE__' => $event->title, '__AUTHOR__' => $event->login, '__DATE__' => $event->firstdate, '__CONTENT__' => $event->text); if ($event->text) { $content .= Template::getInstance()->get('long', $data, 'news'); } else { $content .= Template::getInstance()->get('short', $data, 'news'); } } return $content; }
/** * Set the template to get/render * * @param string $template Template file name * @return Template Return an instance of Template */ public function setTemplate($template) { $tpl = Template::getInstance(); // Assign all models to template if (is_array($this->_model) && !empty($this->_model)) { foreach ($this->_model as $k => $v) { $tpl->assign($k, $v); } } $tpl->addTemplateDir(WEBAPP_MODULES_DIR . DS . $this->_module . DS . 'template'); $tpl->addTemplateDir(MODULES_DIR . DS . $this->_module . DS . 'template'); $tpl->setTemplate($template); return $tpl; }
public function generate() { try { $this->setData('exec', $this->genExecList()); $this->setData('theme', $this->genThemeList()); $this->setData('script', $this->genScriptList()); $this->setData('content', $this->splitContent()); $this->setData('command', Session::DATA('command')); $this->setData('target', Session::DATA('target')); $this->setData('method', Session::DATA('method')); return Template::getInstance()->get('ajax', $this->data); } catch (CoreException $exception) { throw new CoreException("Cannot Generate Ajax Xml"); } }
public function generate() { global $tplData; $options = ''; foreach ($this->option as $option) { if (is_object($option)) { $options .= $option->generate(); } else { $options .= $option; } } if (!$this->opened) { $tplData['__PREPARE__'] .= 'menuClose(' . $this->id . ');'; } $data = array('__ID__' => $this->id, '__TITLE__' => $this->title, '__URL__' => $this->url, '__OPTION__' => $options, '__OPENED__' => $this->opened); return Template::getInstance()->get('box', $data, 'org.sygil.menu.box'); }
function show() { $this->respond->article_id = $this->input->getInt("article_id"); $query = "SELECT name, content, time, email FROM wb_comment\n\t\t\t\t\tWHERE (article_id={$this->respond->article_id}\n\t\t\t\t\tAND private=0 AND status='approve')"; fb($query); $result = $this->db->query($query)->fetchAll(); $article_query = "SELECT title FROM wb_articles\n\t\t\t\t\t\t\tWHERE id={$this->respond->article_id}"; $article_title = $this->db->query($article_query)->fetch()->title; fb($result, 'comments'); $tmpl = Template::getInstance('empty.tpl'); $tmpl->loadPage('comment'); $tmpl->assign('comment_list', $result); $tmpl->assign('article_title', $article_title); $tmpl->assign('post_id', $this->respond->article_id); //require 'temp/comment_template.php'; Session::getInstance()->Captcha = $this->randomString(); Response::getInstance()->setTemplate($tmpl); }
public function generate() { global $tplData; $options = ''; foreach ($this->option as $option) { if (is_object($option)) { $options .= $option->generate(); } else { $options .= $option; } } if (!$this->opened) { $tplData['__PREPARE__'] .= 'menuClose(' . $this->id . ');'; } $data = array('__ID__' => $this->name, '__OPTION__' => $options, '__ISSUB__' => $this->parent ? 'true' : 'false', '__PARENT__' => $this->parent ? $this->parent : 'null', '__STYLE__' => $this->position->getCSS(0)); $core = Core::getInstance(); return Template::getInstance()->get('box', $data, 'org.sygil.menu.vertical'); }
public function show() { $sql = 'SELECT msg.* FROM ge_messages as msg JOIN ge_subdomains as sub USING(site_id) WHERE msg.id=' . $this->input->getInt('id'); $data = $this->db->query($sql)->fetch(); $tmpl = Template::getInstance('userDashboard.tpl'); $tmpl->loadPage('showMessage'); fb($data, 'data'); $tmpl->assign('data', $data); $tmpl->assign('admin', false); $this->reponse->setTitle('لیست درخواستها'); $this->reponse->setTemplate($tmpl); }
public function showCommandManagement($ErrorString = "", $StatusString = "") { if (Controler_Main::getInstance()->getUserLevel() < BACKEND_USERLEVEL) { $ControlerStart = new Controler_Start(); $ControlerStart->start(); return false; } $Request = new Request(); $CommandFinder = new CommandFinder(); $CommandCollection = $CommandFinder->findAll(); $DeviceFinder = new DeviceFinder(); $DeviceCollection = $DeviceFinder->findAll(); $Template = Template::getInstance("tpl_BE_CommandManager.php"); $Template->assign("CommandCollection", $CommandCollection); $Template->assign("DeviceCollection", $DeviceCollection); $Template->assign("ErrorString", $ErrorString); $Template->assign("StatusString", $StatusString); $Template->render(); }
public function show() { $sql = 'SELECT msg.* FROM ge_messages as msg JOIN ge_subdomains as sub USING(site_id) WHERE msg.status="open" and msg.id=' . $this->input->getInt('id'); $data = $this->db->query($sql)->fetch(); $tmpl = Template::getInstance('adminDashboard.tpl'); $tmpl->loadPage('showMessage'); fb($data); $tmpl->assign('data', $data); $tmpl->assign('admin', 1); $this->reponse->setTitle('ارسال پاسخ پیام'); $this->reponse->setTemplate($tmpl); }
public function generate() { $content = ''; $ids = ''; foreach ($this->content as $menu) { if ($this->default == $menu->getId()) { $menu->setActive(); } if ($ids != '') { $ids .= ','; } $ids .= $menu->getId(); $content .= $menu->generate(); } $data = array('__BLOCK__' => $content); Core::getInstance()->addExec('menu_block.list = [' . $ids . '];'); Core::getInstance()->addExec('menu_block.current = ' . $this->default . ';'); return Template::getInstance()->get('manager', $data, 'org.sygil.menu.block'); }