/** * Displays a view * * @param mixed What page to display * @return void * @throws NotFoundException When the view file could not be found * or MissingViewException in debug mode. */ public function display() { $path = func_get_args(); //debug($path); $count = count($path); //debug($count); if (!$count) { return $this->redirect('/'); } $page = $subpage = $title_for_layout = null; //debug(Inflector::humanize($path[$count - 1])); if (!empty($path[0])) { $page = $path[0]; } if (!empty($path[1])) { $subpage = $path[1]; } if (!empty($path[$count - 1])) { $title_for_layout = Inflector::humanize($path[$count - 1]); } $this->set(compact('page', 'subpage', 'title_for_layout')); //debug($this->render(implode('/', $path))); //debug($page); //debug($subpage); //debug($title_for_layout); try { $this->render(implode('/', $path)); } catch (MissingViewException $e) { if (Configure::read('debug')) { throw $e; } throw new NotFoundException(); } }
/** * Displays a view * * @return void * @throws NotFoundException When the view file could not be found * or MissingViewException in debug mode. */ public function display() { $path = func_get_args(); $count = count($path); if (!$count) { return $this->redirect('/'); } $page = $subpage = $title_for_layout = null; if (!empty($path[0])) { $page = $path[0]; } if (!empty($path[1])) { $subpage = $path[1]; } if (!empty($path[$count - 1])) { $title_for_layout = Inflector::humanize($path[$count - 1]); } $this->set(compact('page', 'subpage', 'title_for_layout')); // 获取用户所有的项目 $this->loadModel('Project'); $projects = $this->Project->findAllByUserId($this->Auth->user('id')); $this->set('ProjectList', $projects); try { $this->render(implode('/', $path)); } catch (MissingViewException $e) { if (Configure::read('debug')) { throw $e; } throw new NotFoundException(); } }
public function set_values(array $data) { if (!Valid::url($data['next_url'])) { $data['next_url'] = NULL; } $data['fields'] = array(); if (!empty($data['field']) and is_array($data['field'])) { foreach ($data['field'] as $key => $values) { foreach ($values as $index => $value) { if ($index == 0) { continue; } if ($key == 'source') { $value = URL::title($value, '_'); } $data['fields'][$index][$key] = $value; } } $data['field'] = NULL; } $email_type_fields = array(); foreach ($data['fields'] as $field) { $email_type_fields['key'][] = $field['id']; $email_type_fields['value'][] = !empty($field['name']) ? $field['name'] : Inflector::humanize($field['id']); } $this->create_email_type($email_type_fields); return parent::set_values($data); }
/** * Displays a view * * @param mixed What page to display * @return void */ public function display() { $path = func_get_args(); $count = count($path); if (!$count) { $this->redirect('/'); } $page = $subpage = $titleForLayout = null; if (!empty($path[0])) { $page = $path[0]; } if (!empty($path[1])) { $subpage = $path[1]; } if (!empty($path[$count - 1])) { $titleForLayout = Inflector::humanize($path[$count - 1]); } $this->set(array( 'page' => $page, 'subpage' => $subpage, 'title_for_layout' => $titleForLayout )); $this->render(implode('/', $path)); }
/** * Sample action for uploading a twitpic. Not intended for use in your apps. */ public function add() { if (!empty($this->data)) { if ($this->TwitterAuth->isAuthorized) { if ($this->Twitpic->save($this->data)) { $this->Session->setFlash(__('Twitpic created successfully', true)); $this->redirect(array('action' => 'view', $this->Twitpic->getInsertID())); } else { if (!empty($this->Twitpic->response['error'])) { $flashMessage = $this->Twitpic->response['error']; } elseif (!empty($this->Twitpic->validationErrors)) { $flashMessage = ''; foreach ($this->Twitpic->validationErrors as $field => $errorMessage) { $flashMessage .= Inflector::humanize($field) . ': ' . $errorMessage; } } else { $flashMessage = __('Unknown error', true); } } } else { $flashMessage = __('You are not authorized', true); } $this->Session->setFlash($flashMessage); } }
function display() { $path = func_get_args(); if (!count($path)) { $this->redirect('/'); } $count = count($path); $page = $subpage = $title = null; if (!empty($path[0])) { $page = $path[0]; } if (!empty($path[1])) { $subpage = $path[1]; } if (!empty($path[$count - 1])) { $title = Inflector::humanize($path[$count - 1]); } $this->set(compact('page', 'subpage', 'title')); if ($this->RequestHandler->isMobile()) { // $this->layout = 'iphone'; $this->render(join('/', $path)); } else { $this->render(join('/', $path)); } }
/** * Add a menu item. * * @param string $path dot separated path in the array. * @param array $options menu options array * @return void */ public static function add($path, $options) { if (Reveal::is('Sapi.cli')) { return; } if (!empty($options['access'])) { foreach ((array) $options['access'] as $rule) { $check = strpos($rule, '!') === 0; if ($check) { $rule = substr($rule, 1); } if (Reveal::is($rule) == $check) { return; } } unset($options['access']); } $pathE = explode('.', $path); $pathE = array_splice($pathE, 0, count($pathE) - 2); $parent = join('.', $pathE); if (!empty($parent) && !Hash::check(self::$_items, $parent)) { $title = Inflector::humanize(end($pathE)); $o = array('title' => $title); self::_setupOptions($o); self::add($parent, $o); } self::_setupOptions($options); $current = Hash::extract(self::$_items, $path); if (!empty($current)) { self::_replace(self::$_items, $path, $options); } else { self::$_items = Hash::insert(self::$_items, $path, $options); } }
public function display() { $path = func_get_args(); $count = count($path); if (!$count) { $this->redirect('/'); } $page = $subpage = $title_for_layout = null; if (!empty($path[0])) { $page = $path[0]; } if (!empty($path[1])) { $subpage = $path[1]; } if (!empty($path[$count - 1])) { $title_for_layout = Inflector::humanize($path[$count - 1]); } $this->set(compact('page', 'subpage', 'title_for_layout')); $this->loadModel('Article'); $this->paginate = array('Article' => array('limit' => 5, 'order' => array('id' => 'desc'), 'conditions' => array('is_active' => '1'))); $articledata = $this->paginate('Article'); //pr($articledata); $this->set('dataArt', $articledata); $this->render(implode('/', $path)); }
public function display() { $this->layout = "institutional"; $path = func_get_args(); $count = count($path); if (!$count) { return $this->redirect('/'); } $page = $subpage = $title_for_layout = null; if (!empty($path[0])) { $page = $path[0]; } if (!empty($path[1])) { $subpage = $path[1]; } if (!empty($path[$count - 1])) { $title_for_layout = Inflector::humanize($path[$count - 1]); } $this->set(compact('page', 'subpage', 'title_for_layout')); $pages = $this->Institutional->find('all', array('order' => array('Institutional.id ASC'))); $this->set('pages', $pages); $adm_users = $this->User->find('all', array('conditions' => array('User.role' => 'adm'))); $this->set('adm_users', $adm_users); try { $this->render(implode('/', $path)); } catch (MissingViewException $e) { if (Configure::read('debug')) { throw $e; } throw new NotFoundException(); } }
/** * Sample action for creating a tweet */ public function add() { if (!empty($this->data)) { if ($this->TwitterAuth->isAuthorized) { if ($this->TwitterStatus->tweet($this->data)) { $flashMessage = __('Your status has been updated', true); } else { if (!empty($this->TwitterStatus->response['error'])) { $flashMessage = $this->TwitterStatus->response['error']; } elseif (!empty($this->TwitterStatus->validationErrors)) { $flashMessage = ''; foreach ($this->TwitterStatus->validationErrors as $field => $errorMessage) { $flashMessage .= Inflector::humanize($field) . ': ' . $errorMessage; } } else { $flashMessage = __('Unknown error', true); } } } else { $flashMessage = __('You are not authorized', true); } } $this->Session->setFlash($flashMessage); $this->redirect($this->referer('/', true)); }
/** * Generates a sorting link. Sets named parameters for the sort and direction. Handles * direction switching automatically. * * ### Options: * * - `escape` Whether you want the contents html entity encoded, defaults to true * - `model` The model to use, defaults to PaginatorHelper::defaultModel() * * @param string $title Title for the link. * @param string $key The name of the key that the recordset should be sorted. If $key is null * $title will be used for the key, and a title will be generated by inflection. * @param array $options Options for sorting link. See above for list of keys. * @return string A link sorting default by 'asc'. If the resultset is sorted 'asc' by the specified * key the returned link will sort by 'desc'. * @access public */ function sort($title, $key = null, $options = array()) { $options = array_merge(array('url' => array(), 'model' => null), $options); $url = $options['url']; unset($options['url']); if (empty($key)) { $key = $title; $title = __(Inflector::humanize(preg_replace('/_id$/', '', $title))); } $dir = isset($options['direction']) ? $options['direction'] : 'asc'; unset($options['direction']); $sortKey = $this->sortKey($options['model']); $defaultModel = $this->defaultModel(); $isSorted = $sortKey === $key || $sortKey === $defaultModel . '.' . $key || $key === $defaultModel . '.' . $sortKey; if ($isSorted) { $dir = $this->sortDir($options['model']) === 'asc' ? 'desc' : 'asc'; $class = $dir === 'asc' ? 'desc' : 'asc'; if (!empty($options['class'])) { $options['class'] .= ' ' . $class; } else { $options['class'] = $class; } } if (is_array($title) && array_key_exists($dir, $title)) { $title = $title[$dir]; } $url = array_merge(array('sort' => $key, 'direction' => $dir), $url, array('order' => null)); return $this->link($title, $url, $options); }
/** * Displays a view * * @param mixed What page to display * @access public */ function display() { if (!func_num_args()) { $this->redirect('/'); } $path = func_get_args(); if (!count($path)) { $this->redirect('/'); } $count = count($path); $page = null; $subpage = null; $title = null; if (!empty($path[0])) { $page = $path[0]; } if (!empty($path[1])) { $subpage = $path[1]; } if (!empty($path[$count - 1])) { $title = Inflector::humanize($path[$count - 1]); } $this->set('page', $page); $this->set('subpage', $subpage); $this->set('title', $title); $this->render(join('/', $path)); }
/** * Displays a view * * @param mixed What page to display * @access public */ function display() { $path = func_get_args(); $count = count($path); if (!$count) { $this->redirect('/'); } $page = $subpage = $title_for_layout = null; if (!empty($path[0])) { $page = $path[0]; } if (!empty($path[1])) { $subpage = $path[1]; } if (!empty($path[$count - 1])) { $title_for_layout = Inflector::humanize($path[$count - 1]); } //To load custom data for a page, add a _$page method, and it will trigger. //You can set data there for that page. if (isset($page) && method_exists($this, '_' . $page)) { call_user_method('_' . $page, $this); } $this->set(compact('page', 'subpage', 'title_for_layout')); $this->render(implode('/', $path)); }
/** * Displays a view * * @param mixed What page to display * @access public */ function display() { $path = func_get_args(); $count = count($path); if (!$count) { $this->redirect('/'); } $page = $subpage = $title_for_layout = null; if (!empty($path[0])) { $page = $path[0]; } if (!empty($path[1])) { $subpage = $path[1]; } if (!empty($path[$count - 1])) { $title_for_layout = Inflector::humanize($path[$count - 1]); } $user = $this->Auth->user(); if($path[0] == 'upgrade' && empty($user)){ $this->layout = 'client_review'; } $this->set(compact('page', 'subpage', 'title_for_layout')); $this->render(implode('/', $path)); }
/** * Displays a view * * @param mixed What page to display * @access public */ function display() { $path = func_get_args(); $count = count($path); if (!$count) { $this->redirect('/'); } $page = $subpage = $title = null; if (!empty($path[0])) { $page = $path[0]; } if (!empty($path[1])) { $subpage = $path[1]; } if (!empty($path[$count - 1])) { $title = Inflector::humanize($path[$count - 1]); } if ($page == 'demo') { $this->layout = 'ajax'; } $this->set(compact('page', 'subpage', 'title')); if (!$this->siteDown) { $this->render(join('/', $path)); } else { $this->layout = 'blank'; $this->render(join('/', $path)); } }
/** * Displays a view * * @param mixed What page to display * @access public */ function display() { $path = func_get_args(); $count = count($path); if (!$count) { $this->redirect('/'); } $page = $subpage = $title_for_layout = null; if (!empty($path[0])) { $page = $path[0]; } if (!empty($path[1])) { $subpage = $path[1]; } if (!empty($path[$count - 1])) { $title_for_layout = Inflector::humanize($path[$count - 1]); } if ($page == 'home') { $trustedProfiles = $this->Profile->trustedTen('title'); $trustedJobs = $this->Job->trustedTen('title'); $trustedDisplay = array_merge($trustedProfiles, $trustedJobs); shuffle($trustedDisplay); $this->set('trustedDisplay', $trustedDisplay); } $this->set(compact('page', 'subpage', 'title_for_layout')); $this->render(implode('/', $path)); }
/** * List of options * * @param null|string $prefix */ public function admin_prefix($prefix = null) { $prefix_name = ['general' => __d('hurad', 'General'), 'comment' => __d('hurad', 'Comment'), 'permalink' => __d('hurad', 'Permalink'), 'read' => __d('hurad', 'Read')]; $this->set('title_for_layout', sprintf(__d('hurad', '%s Option'), $prefix_name[$prefix])); if (!array_key_exists($prefix, $prefix_name)) { $this->Session->setFlash(__d('hurad', 'Invalid Option name'), 'flash_message', ['class' => 'danger']); /* @todo Set admin prefix config */ $this->redirect('/admin'); } if ($this->request->is('post') || $this->request->is('put')) { switch ($this->request->param('pass')[0]) { case 'general': $this->request->data['Option']['site_url'] = rtrim($this->request->data['Option']['site_url'], "/"); break; } $opt = []; foreach ($this->request->data as $optionArray) { foreach ($optionArray as $option => $value) { $opt[Inflector::humanize($prefix) . '.' . $option] = $value; } } $optionData['Option'] = $opt; if ($this->Option->update($optionData)) { $this->Session->setFlash(__d('hurad', 'Options have been updated!'), 'flash_message', ['class' => 'success']); } else { $this->Session->setFlash(__d('hurad', 'Unable to update ' . $prefix . ' options.'), 'error-option', ['errors' => $this->Option->validationErrors]); } } else { $this->request->data['Option'] = Configure::read(Inflector::humanize($prefix)); } $this->set('errors', $this->Option->validationErrors); $this->set(compact('prefix')); }
function viewlist($page_template_id) { $this->loadSubnav($page_template_id); $this->auto_render = false; $html = ''; if (!$page_template_id) { // This is a bit of a hack. header('Location: /nterchange/page_template/viewlist'); } $model = $this->getDefaultModel($this->name); $model->page_template_id = $page_template_id; // Let's get more information about the page_template. if ($page_template = $model->getLink('page_template_id', 'page_template')) { $this->set('page_template_name', $page_template->template_name); $this->set('page_template_filename', $page_template->template_filename); } $this->set('page_template_id', $page_template_id); if ($model->find()) { while ($model->fetch()) { $arr = $model->toArray(); $arr['_headline'] = isset($arr['cms_headline']) && $arr['cms_headline'] ? $arr['cms_headline'] : $model->makeHeadline(); $models[] = $arr; unset($arr); } $html .= $this->set('rows', $models); } else { $this->set('notice', 'There are no containers for that template.'); } $html .= $this->set(array('asset' => $this->name, 'asset_name' => $this->page_title ? $this->page_title : Inflector::humanize($this->name))); $html .= $this->render(array('layout' => 'default')); return $html; }
/** * Pull the update for a specific plugin submodule * * @return void * @author Jose Diaz-Gonzalez **/ function __doUpdateSpecific() { $this->out("\nThe following is a list of all installed submodules"); $validCommands = array(); $installedPlugins = $this->__listPlugins(); foreach ($installedPlugins as $key => $plugin) { $this->out(" " . $key + 1 . ". " . Inflector::humanize($plugin) . " Plugin"); $validCommands[] = $key + 1; } $validCommands[] = 'q'; $enteredPlugin = null; while ($enteredPlugin === null) { $enteredPlugin = $this->in(__("Enter a number from the list above or 'q' or nothing to exit", true), null, 'q'); if ($enteredPlugin === 'q') { // Quit $this->out(__("Exit", true)); $this->_stop(); } elseif (in_array($enteredPlugin, $validCommands)) { // cd into the plugins directory and update it $this->out(Inflector::humanize($plugin) . " Plugin"); $this->out(shell_exec("cd " . $this->params['working'] . "/plugins/{$installedPlugins[$enteredPlugin - 1]} ; git remote update ")); $this->out(shell_exec("cd " . $this->params['working'] . "/plugins/{$installedPlugins[$enteredPlugin - 1]} ; git merge origin/master ")); } else { $enteredPlugin = null; } } }
public function install() { $default_alias = 'Fondy'; $default_name = __('Fondy'); $default_description = "{payment alias='Fondy'}"; $this->ModuleBase->create_core_page($default_alias, $default_name, $default_description); $new_module = array(); $new_module['PaymentMethod']['active'] = '1'; $new_module['PaymentMethod']['default'] = '0'; $new_module['PaymentMethod']['name'] = Inflector::humanize($this->module_name); $new_module['PaymentMethod']['icon'] = $this->icon; $new_module['PaymentMethod']['alias'] = $this->module_name; $new_module['PaymentMethodValue'][0]['fondy_merchant_id'] = $this->PaymentMethod->id; $new_module['PaymentMethodValue'][0]['key'] = 'fondy_merchant_id'; $new_module['PaymentMethodValue'][0]['value'] = ''; $new_module['PaymentMethodValue'][1]['fondy_secret_key'] = $this->PaymentMethod->id; $new_module['PaymentMethodValue'][1]['key'] = 'fondy_secret_key'; $new_module['PaymentMethodValue'][1]['value'] = ''; $new_module['PaymentMethodValue'][2]['fondy_lang_key'] = $this->PaymentMethod->id; $new_module['PaymentMethodValue'][2]['key'] = 'fondy_lang_key'; $new_module['PaymentMethodValue'][2]['value'] = ''; $new_module['PaymentMethodValue'][3]['fondy_cur_key'] = $this->PaymentMethod->id; $new_module['PaymentMethodValue'][3]['key'] = 'fondy_cur_key'; $new_module['PaymentMethodValue'][3]['value'] = 'RUB'; $this->PaymentMethod->saveAll($new_module); $this->Session->setFlash(__('Module Installed')); $this->redirect('/payment_methods/admin/'); }
function load($admin, $useDbAssociations = false) { // Load an instance of the admin model object $plugin = Inflector::camelize($admin->plugin); $modelObj = ClassRegistry::init(array('class' => "{$plugin}.{$admin->modelName}Admin", 'table' => $admin->useTable, 'ds' => $admin->useDbConfig)); $adminModelObj = ClassRegistry::init(array('class' => "{$plugin}.{$admin->modelName}Admin", 'table' => $admin->useTable, 'ds' => $admin->useDbConfig)); $modelClass = $admin->modelName . 'Admin'; $primaryKey = $adminModelObj->primaryKey; $displayField = $adminModelObj->displayField; $schema = $adminModelObj->schema(true); $fields = array_keys($schema); $controllerName = $this->_controllerName($admin->modelName); $controllerRoute = $this->_pluralName($admin->modelName); $pluginControllerName = $this->_controllerName($admin->modelName . 'Admin'); $singularVar = Inflector::variable($modelClass); $singularName = $this->_singularName($modelClass); $singularHumanName = $this->_singularHumanName($this->_controllerName($admin->modelName)); $pluralVar = Inflector::variable($pluginControllerName); $pluralName = $this->_pluralName($modelClass); $pluralHumanName = Inflector::humanize($this->_pluralName($controllerName)); if ($useDbAssociations) { $associations = $this->loadAssociations($modelObj, $admin); } else { $associations = $this->__associations($adminModelObj); } return compact('admin', 'modelObj', 'adminModelObj', 'modelClass', 'primaryKey', 'displayField', 'schema', 'fields', 'controllerName', 'controllerRoute', 'pluginControllerName', 'singularVar', 'singularName', 'singularHumanName', 'pluralVar', 'pluralName', 'pluralHumanName', 'associations'); }
/** * Add a menu item * * @param string $path dot separated path in the array. * @param array $options menu options array * @return void */ public static function add($menu, $path, $options = array()) { // Juggle argument for backward compatibility if (is_array($path)) { $options = $path; $path = $menu; $menu = self::activeMenu(); } else { self::activeMenu($menu); } $pathE = explode('.', $path); $pathE = array_splice($pathE, 0, count($pathE) - 2); $parent = join('.', $pathE); if (!empty($parent) && !Hash::check(self::$_items[$menu], $parent)) { $title = Inflector::humanize(end($pathE)); $o = array('title' => $title); self::_setupOptions($o); self::add($parent, $o); } self::_setupOptions($options); $current = Hash::extract(self::$_items[$menu], $path); if (!empty($current)) { self::_replace(self::$_items[$menu], $path, $options); } else { self::$_items[$menu] = Hash::insert(self::$_items[$menu], $path, $options); } }
/** * Retrieves and paints the list of tests cases in an HTML format. * * @return void */ public function testCaseList() { $testCases = parent::testCaseList(); $core = $this->params['core']; $plugin = $this->params['plugin']; $buffer = "<h3>App Test Cases:</h3>\n<ul>"; $urlExtra = null; if ($core) { $buffer = "<h3>Core Test Cases:</h3>\n<ul>"; $urlExtra = '&core=true'; } elseif ($plugin) { $buffer = "<h3>" . Inflector::humanize($plugin) . " Test Cases:</h3>\n<ul>"; $urlExtra = '&plugin=' . $plugin; } if (count($testCases) < 1) { $buffer .= "<strong>EMPTY</strong>"; } foreach ($testCases as $testCase) { $title = explode(DS, str_replace('.test.php', '', $testCase)); $title[count($title) - 1] = Inflector::camelize($title[count($title) - 1]); $title = implode(' / ', $title); $buffer .= "<li><a href='" . $this->baseUrl() . "?case=" . urlencode($testCase) . $urlExtra . "'>" . $title . "</a></li>\n"; } $buffer .= "</ul>\n"; echo $buffer; }
function addPage($iLevel = null, $sTitle = null, $sUrl = null, $aParameters = array()) { if ($iLevel == 0) { $this->clear(); } if (is_null($sUrl)) { $sLink = $this->sProtocol . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; } else { $sLink = $this->sProtocol . '://' . $_SERVER['HTTP_HOST'] . $this->base . "/" . $sUrl; } $sController = $this->params['controller']; $sAction = $this->params['action']; if (is_null($sTitle)) { $sTitle = Inflector::humanize($sController); } if (!isset($_SESSION['aCrumb'])) { $_SESSION['aCrumb'] = array(); } $aCrumb = $this->Session->read('aCrumb'); if (array_key_exists($iLevel, $aCrumb)) { $aCrumb = $this->__stripAfter($aCrumb, $iLevel); } else { $oCrumb = new stdClass(); $oCrumb->sUrl = $sLink; $oCrumb->sTitle = $sTitle; $oCrumb->aParameters = $aParameters; $aCrumb[$iLevel] = $oCrumb; } $_SESSION['aCrumb'] = $aCrumb; }
/** * Displays a view * * @return void * @throws NotFoundException When the view file could not be found * or MissingViewException in debug mode. */ public function home() { // Redirect to tasks page Router::redirect('*', array('controller' => 'tasks', 'action' => 'index')); $path = func_get_args(); $count = count($path); if (!$count) { return $this->redirect('/'); } $page = $subpage = $title_for_layout = null; if (!empty($path[0])) { $page = $path[0]; } if (!empty($path[1])) { $subpage = $path[1]; } if (!empty($path[$count - 1])) { $title_for_layout = Inflector::humanize($path[$count - 1]); } $this->set(compact('page', 'subpage', 'title_for_layout')); try { $this->render(implode('/', $path)); } catch (MissingViewException $e) { if (Configure::read('debug')) { throw $e; } throw new NotFoundException(); } }
function _writeHeaders(&$xls, $options) { $sheet = $xls->getActiveSheet(); if (!empty($options['columnHeaders'])) { $columnHeaders = $options['columnHeaders']; } else { $columnHeaders = $options['fields']; foreach ($columnHeaders as &$header) { if (strstr($header, '.')) { $split = explode('.', $header, 2); $header = Inflector::humanize($split[1]); } else { $header = Inflector::humanize($header); } } unset($header); } $col = ord('A'); for ($i = 0, $ii = count($columnHeaders); $i < $ii; $i++) { $header = $columnHeaders[$i]; $cell = chr($col) . '1'; $sheet->setCellValue($cell, $header); $col++; } }
public function display() { $path = func_get_args(); $count = count($path); if (!$count) { $this->redirect('/'); } $page = $subpage = $title_for_layout = null; if (!empty($path[0])) { $page = $path[0]; } if (!empty($path[1])) { $subpage = $path[1]; } if (!empty($path[$count - 1])) { $title_for_layout = Inflector::humanize($path[$count - 1]); } $this->loadModel('Category'); //$cats = $this->Category->find('list', array('order'=> array('Category.cat_name' => 'ASC'))); $cats = $this->Category->find('list'); // print_r($cats); $posts = array(); $index = 1; foreach ($cats as $key => $value) { $this->loadModel('Post'); $threads = $this->Post->find('threaded', array('fields' => array('post_id', 'Category.cat_name', 'Topic.topic_subject', 'parent_id'), 'conditions' => array('Category.cat_name' => $value, 'Topic.topic_cat' => $key))); $posts[$index]['Category'] = $value; $posts[$index]['Threads'] = $threads; $index++; } $this->set('posts', $posts); $this->set(compact('page', 'subpage', 'title_for_layout')); $this->render(implode('/', $path)); }
/** * Displays a view * * @return void * @throws NotFoundException When the view file could not be found * or MissingViewException in debug mode. */ public function display() { $AuditeventusersController = new AuditeventusersController(); $AuditeventusersController->register(3, 1); $this->set('pqrscompletadas', ClassRegistry::init('Pqr')->find('count', array('conditions' => array('Pqr.state' => 3, 'Pqr.id_client' => 1)))); $this->set('totalcompletadas', ClassRegistry::init('Pqr')->find('count', array('conditions' => array('Pqr.id_client' => 1)))); $this->set('documentosactualizados', ClassRegistry::init('Clientdocument')->find('count', array('conditions' => array('Clientdocument.state' => 3, 'Clientdocument.client' => 1)))); $this->set('totaldocumentos', ClassRegistry::init('Clientdocument')->find('count', array('conditions' => array('Clientdocument.client' => 2)))); $this->set('userauth', ClassRegistry::init('User')->findById(1)); $path = func_get_args(); $count = count($path); if (!$count) { return $this->redirect('/'); } $page = $subpage = $title_for_layout = null; if (!empty($path[0])) { $page = $path[0]; } if (!empty($path[1])) { $subpage = $path[1]; } if (!empty($path[$count - 1])) { $title_for_layout = Inflector::humanize($path[$count - 1]); } $this->set(compact('page', 'subpage', 'title_for_layout')); try { $this->render(implode('/', $path)); } catch (MissingViewException $e) { if (Configure::read('debug')) { throw $e; } throw new NotFoundException(); } }
/** * Generate a test case list in plain text. * Creates as series of url's for tests that can be run. * One case per line. * * @return void */ public function testCaseList() { // CUSTOMIZE MODIFY 2014/07/02 ryuring // >>> //$testCases = parent::testCaseList(); // --- $testCases = BaserTestLoader::generateTestList($this->params); $baser = $this->params['baser']; // <<< $app = $this->params['app']; $plugin = $this->params['plugin']; $buffer = "Core Test Cases:\n"; // CUSTOMIZE MODIFY 2014/07/02 ryuring // >>> //if ($app) { // --- if ($baser) { $buffer = "Baser Test Cases:\n"; $urlExtra = '&baser=true'; } elseif ($app) { // <<< $buffer = "App Test Cases:\n"; } elseif ($plugin) { $buffer = Inflector::humanize($plugin) . " Test Cases:\n"; } if (count($testCases) < 1) { $buffer .= 'EMPTY'; echo $buffer; } foreach ($testCases as $testCase) { $buffer .= $_SERVER['SERVER_NAME'] . $this->baseUrl() . "?case=" . $testCase . "&output=text\n"; } $buffer .= "\n"; echo $buffer; }
/** * Comment Template. * * @todo -c Implement .this needs to be sorted out. * * Copyright (c) 2009 Carl Sutton ( dogmatic69 ) * * Licensed under The MIT License * Redistributions of files must retain the above copyright notice. * * @filesource * @copyright Copyright (c) 2009 Carl Sutton ( dogmatic69 ) * @link http://www.dogmatic.co.za * @package sort * @subpackage sort.comments * @license http://www.opensource.org/licenses/mit-license.php The MIT License * @since 0.5a */ function clear($filter, $div = false) { if (!isset($filter['url'][0]) || empty($filter['url'][0]) || $filter['url'][0] == '/') { $filter['url'][0] = '/'; } $out = ''; if ($div) { $out .= '<div class="filter">'; } $out .= '<div class="wrap">'; $parts = explode('/', $filter['url'][0]); $done = array(); foreach ($parts as $_f) { if (empty($_f) || in_array($_f, $done)) { continue; } $done[] = $_f; $text = explode(':', $_f); $text = explode('.', $text[0]); $text = count($text) > 1 ? $text[1] : $text[0]; $out .= '<div class="left">' . '<div class="remove">' . $this->Html->link(Inflector::humanize($text), str_replace($_f, '', '/' . $this->params['url']['url'])) . '</div>' . '</div>'; } $out .= '</div>'; if ($div) { $out .= '</div>'; } return $out; }