public function _get_method($method, &$args) { $this->module = $this->load->module($method); if (isset($this->module)) { if (count($args)) { return array_shift($args); } else { return 'index'; } } else { show_error(lang_f('No module named %s found!', $method)); } }
function smarty_function_banner($params, $template) { $src = get_default($params, 'src', null); if ($src == null) { ci_error(lang_f('The banner\'s attribute src must be set!')); return ''; } $params['class'] = make_classes('pinet_banner', get_default($params, 'class', null)); $height = get_default($params, 'height', null); if ($height != null) { $params['style'] .= 'height:' . $height . ';'; } return create_tag('div', $params, array(), ''); }
public function login($id, $password) { $this->result_mode = 'object'; $this->db->or_where(array('username' => $id, 'email_address' => $id)); $ret = $this->get(); if (isset($ret->id)) { if ($ret->password == md5($password)) { $now = new DateTime(); $this->update($ret->id, array('timestamp' => $now->format('Y-m-d H:i:s'))); $this->session->set_userdata('user_id', $ret->id); return $ret->id; } return lang_f('The password for user %s is not correct!', $id); } return lang_f('Username or email address %s is not found.', $id); }
function render($template, $args = array()) { $t = ''; if (isset($this->title)) { $t = $this->title; } if (isset($args['title'])) { $t = $args['title']; } if (isset($this->navigation)) { $args['navigations'] = $this->navigation->getNavigations(); } if (is_array($t)) { $args['title'] = lang_f($t[0], $t[1]); } else { $args['title'] = lang($t); } if (!$this->input->get('nohead')) { $args['has_head'] = true; } else { $args['has_head'] = false; } $this->smartyview->render($template . '.tpl', $args); }
public function render($name, $args = array()) { $this->out = array(); $this->mesh_page = $this->model->getMeshPage($name); if (!$this->mesh_page) { show_error(lang_f('Can\'t find mesh page named %s to render', $name)); return; } $this->initWidgets(); $this->processLayout(); $mesh_page = $this->mesh_cache . $name . microtime(); $content = implode("\n", $this->out); file_put_contents($mesh_page . '.tpl', $content); $this->CI->render($mesh_page, $args); }
public function loadConfig() { $path = dirname(get_class_script_path($this)) . '/widget.json'; if (file_exists($path)) { $json = file_get_contents($path); $this->config = json_decode($json); ci_log('The config is ', $this->config); } else { show_error(lang_f('Cant\'t find configuration file for widget %s', get_class($this))); } }
public function portal() { $this->load->model(array('user_model', 'portal_page_model')); $settings = $this->portal_page_model->getPortalSettings($this->user_model->getLoginUserID()); $this->init_responsive(); $this->less('api/signin_css'); $data = array('logo' => 'signin-logo.png', 'contents' => lang_f('<span>Welcome to</span> %s', 'Waldorf Astoria'), 'company' => 'Waldorf Astoria'); $this->render('api/signin', array_merge($data, $settings)); }
function render($template, $args = array()) { $t = ''; if (isset($this->title)) { $t = $this->title; } if (isset($args['title'])) { $t = $args['title']; } if (isset($this->navigation)) { $args['navigations'] = $this->navigation->getNavigations(); } if (get_ci_config('less_js')) { $args['use_less_js'] = true; } if (is_array($t)) { $args['title'] = lang_f($t[0], $t[1]); } else { $args['title'] = lang($t); } if (!$this->input->get('nohead')) { $args['has_head'] = true; } else { $args['has_head'] = false; } if (isset($this->interceptors) && isset($this->interceptors['render'])) { foreach ($this->interceptors['render'] as $i) { $i->intercept($template, $args); } } $this->smartyview->render($template . '.tpl', $args); }