Example #1
0
 /**
  * Render the contents using the current layout and template.
  * Overridden to support plugin templates
  *
  * @param   string  $content Content to render
  * @return  array   Email ready to be sent
  */
 public function _render($content)
 {
     $msg = array();
     $content = implode("\n", $content);
     if ($this->sendAs === 'both') {
         $htmlContent = $content;
         if (!empty($this->attachments)) {
             $msg[] = '--' . $this->__boundary;
             $msg[] = 'Content-Type: multipart/alternative; boundary="alt-' . $this->__boundary . '"';
             $msg[] = '';
         }
         $msg[] = '--alt-' . $this->__boundary;
         $msg[] = 'Content-Type: text/plain; charset=' . $this->charset;
         $msg[] = 'Content-Transfer-Encoding: 7bit';
         $msg[] = '';
         $content = $this->_view->element('email' . DS . 'text' . DS . $this->template, array('content' => $content, 'plugin' => 'Referee'), true);
         $this->_view->layoutPath = 'email' . DS . 'text';
         $content = explode("\n", $this->textMessage = str_replace(array("\r\n", "\r"), "\n", $this->_view->renderLayout($content)));
         $msg = array_merge($msg, $content);
         $msg[] = '';
         $msg[] = '--alt-' . $this->__boundary;
         $msg[] = 'Content-Type: text/html; charset=' . $this->charset;
         $msg[] = 'Content-Transfer-Encoding: 7bit';
         $msg[] = '';
         $htmlContent = $this->_view->element('email' . DS . 'html' . DS . $this->template, array('content' => $htmlContent, 'plugin' => 'Referee'), true);
         $this->_view->layoutPath = 'email' . DS . 'html';
         $htmlContent = explode("\n", $this->htmlMessage = str_replace(array("\r\n", "\r"), "\n", $this->_view->renderLayout($htmlContent)));
         $msg = array_merge($msg, $htmlContent);
         $msg[] = '';
         $msg[] = '--alt-' . $this->__boundary . '--';
         $msg[] = '';
         return $msg;
     }
     if (!empty($this->attachments)) {
         if ($this->sendAs === 'html') {
             $msg[] = '';
             $msg[] = '--' . $this->__boundary;
             $msg[] = 'Content-Type: text/html; charset=' . $this->charset;
             $msg[] = 'Content-Transfer-Encoding: 7bit';
             $msg[] = '';
         } else {
             $msg[] = '--' . $this->__boundary;
             $msg[] = 'Content-Type: text/plain; charset=' . $this->charset;
             $msg[] = 'Content-Transfer-Encoding: 7bit';
             $msg[] = '';
         }
     }
     $content = $this->_view->element('email' . DS . $this->sendAs . DS . $this->template, array('content' => $content, 'plugin' => 'Referee'), true);
     $this->_view->layoutPath = 'email' . DS . $this->sendAs;
     $content = explode("\n", $rendered = str_replace(array("\r\n", "\r"), "\n", $this->_view->renderLayout($content)));
     if ($this->sendAs === 'html') {
         $this->htmlMessage = $rendered;
     } else {
         $this->textMessage = $rendered;
     }
     $msg = array_merge($msg, $content);
     return $msg;
 }
Example #2
0
 public function rescan_locale()
 {
     if ($this->token->validate('rescan_locale')) {
         $u = new \User();
         if ($u->isSuperUser()) {
             \Core::make('cache/request')->disable();
             $section = Section::getByID($_REQUEST['locale']);
             $target = new MultilingualProcessorTarget($section);
             $processor = new Processor($target);
             if ($_POST['process']) {
                 foreach ($processor->receive() as $task) {
                     $processor->execute($task);
                 }
                 $obj = new \stdClass();
                 $obj->totalItems = $processor->getTotalTasks();
                 echo json_encode($obj);
                 exit;
             } else {
                 $processor->process();
             }
             $totalItems = $processor->getTotalTasks();
             \View::element('progress_bar', array('totalItems' => $totalItems, 'totalItemsSummary' => t2("%d task", "%d tasks", $totalItems)));
             exit;
         }
     }
 }
 public function edit($id = null)
 {
     $this->autoRender = false;
     $content = array();
     if (!$this->Member->exists($id)) {
         throw new NotFoundException(__('Invalid Team'));
     }
     if ($this->request->is(array('post', 'put'))) {
         $this->Member->id = $id;
         $this->Member->set($this->request->data);
         if ($this->Member->save()) {
             $this->Session->setFlash(__('The Member has been saved.'));
         } else {
             $this->Session->setFlash(__('The Member could not be saved. Please, try again.'));
         }
         return $this->redirect(array('action' => 'index'));
     } else {
         $options = array('conditions' => array('Member.' . $this->Member->primaryKey => $id));
         $this->request->data = $this->Member->find('first', $options);
     }
     $options = array('conditions' => array('Member.' . $this->Member->primaryKey => $id));
     $members = $this->Member->find('first', $options);
     $content['members'] = $members;
     $team = $this->Member->Team->find('list', array('fields' => array('team')));
     $content['team'] = $team;
     $view = new View($this, false);
     return $view->element('editMember', array('content' => $content));
 }
 public function displayObjectCollection()
 {
     $em = \ORM::entityManager('migration_tool');
     $r = $em->getRepository("\\PortlandLabs\\Concrete5\\MigrationTool\\Entity\\Import\\Batch");
     $batch = $r->findFromCollection($this->collection);
     print \View::element('batch_content_types/' . $this->getElement(), array('batch' => $batch, 'type' => $this->collection->getType(), 'collection' => $this->collection), 'migration_tool');
 }
 /**
  * 
  * @return <array> with chats datas
  */
 public function admin_total_issuers()
 {
     $this->loadModel('Transaction');
     # obtendo sql que captura os dado para o gráfico
     $sql = file_get_contents(APP . 'Outside' . DS . 'Scripts' . DS . 'management_painel' . DS . 'total_issuers.sql');
     $view = new View();
     $this->returnJs($view->element('../Management/admin/partial/total_issuers_table', array('total_issuers' => $this->Transaction->query($sql))));
 }
 public function html($id, $slug = '')
 {
     $pismo = $this->load($id);
     $view = new View($this, false);
     $html = $view->element('html', array('pismo' => $pismo));
     echo $html;
     die;
 }
 protected function renderElement($element, $data = array())
 {
     $view = new View(ClassRegistry::getObject('EventController'), false);
     $view->set('data', $data);
     $html = $view->element($element, $this->params, true);
     $view = null;
     unset($view);
     return $html;
 }
Example #8
0
 public function rescan_locale()
 {
     if ($this->token->validate('rescan_locale')) {
         $u = new \User();
         if ($u->isSuperUser()) {
             \Core::make('cache/request')->disable();
             $section = Section::getByID($_REQUEST['locale']);
             $target = new MultilingualProcessorTarget($section);
             $processor = new Processor($target);
             if ($_POST['process']) {
                 foreach ($processor->receive() as $task) {
                     $processor->execute($task);
                 }
                 $obj = new \stdClass();
                 $obj->totalItems = $processor->getTotalTasks();
                 print json_encode($obj);
                 exit;
             } else {
                 $processor->process();
             }
             $totalItems = $processor->getTotalTasks();
             \View::element('progress_bar', array('totalItems' => $totalItems, 'totalItemsSummary' => t2("%d task", "%d tasks", $totalItems)));
             /*
             $q = Queue::get('rescan_multilingual_section');
             if ($_POST['process']) {
                 $obj = new \stdClass;
                 $messages = $q->receive(\Config::get('concrete.limits.copy_pages'));
                 foreach($messages as $key => $p) {
                     // delete the page here
                     $page = unserialize($p->body);
                     $oc = \Page::getByID($page['cID']);
             
             
                     $q->deleteMessage($p);
                 }
             
                 $obj->totalItems = $q->count();
                 print json_encode($obj);
                 if ($q->count() == 0) {
                     $q->deleteQueue('rescan_multilingual_section');
                 }
                 exit;
             
             } else if ($q->count() == 0) {
                 $oc = Section::getByID($_REQUEST['locale']);
                 if (is_object($oc) && !$oc->isError()) {
                     $oc->queueForDeletionRequest($q, false);
                 }
             }
             $totalItems = $q->count();
             \View::element('progress_bar', array('totalItems' => $totalItems, 'totalItemsSummary' => t2("%d page", "%d pages", $totalItems)));
             */
             exit;
         }
     }
 }
 public function index()
 {
     // Build conditions table
     $conditions = array();
     if (!empty($this->request->data['Filter']['search'])) {
         $conditions['ProjectProject.title LIKE'] = '%' . $this->request->data['Filter']['search'] . '%';
     }
     $this->Paginator->settings['fields'] = array('ProjectProject.id', 'ProjectProject.title', 'ProjectProject.is_active');
     $this->Paginator->settings['contain'] = array('ProjectTask' => array('id', 'conditions' => array('project_task_status_id NOT IN' => array(4, 5))));
     $this->Paginator->settings['order'] = array('ProjectProject.is_active' => 'DESC', 'ProjectProject.title');
     $projects = $this->Paginator->paginate('ProjectProject', $conditions);
     if ($this->request->is('ajax')) {
         $this->layout = 'ajax';
         $this->autoRender = false;
         $view = new View($this);
         return json_encode(array('content' => $view->element('Project.projects-table-loop', array('projects' => $projects)), 'pagination' => $view->element('pagination')));
     }
     $this->set('projects', $projects);
 }
Example #10
0
 public function getElements()
 {
     $this->autoRender = false;
     $view = new View($this, false);
     if ($this->request->is('ajax')) {
         $options = json_decode($this->request->data['options'], true);
         $nome = $this->request->data['nome'];
         echo json_encode($view->element($nome, $options));
     }
 }
Example #11
0
 /**
  * Overwrites the View::element() function so we can deal with the $type parameter
  * 
  * @access public
  * @return string The result of View::element()
  */
 function element($name, $params = array(), $loadHelpers = false)
 {
     $typeBkp = $this->getVar('type');
     if (isset($params['type'])) {
         $this->viewVars['type'] = $params['type'];
     }
     $out = parent::element($name, $params, $loadHelpers);
     $this->viewVars['type'] = $typeBkp;
     return $out;
 }
Example #12
0
 static function deliver($template, $options = array())
 {
     $options = Set::merge(array('vars' => array(), 'mail' => array('to' => array(), 'from' => Configure::read('App.emails.noReply'), 'charset' => 'utf8', 'sendAs' => 'text', 'subject' => '', 'template' => $template, 'layout' => 'email', 'attachments' => array()), 'store' => false), $options);
     if (!empty($options['mail']['subject'])) {
         $options['mail']['subject'] = strip_tags($options['mail']['subject']);
     }
     $delivery = Configure::read('App.emailDeliveryMethod');
     if (!empty($delivery) && !isset($options['mail']['delivery'])) {
         $options['mail']['delivery'] = $delivery;
     }
     if (isset($options['mail']['delivery']) && $options['mail']['delivery'] == 'smtp') {
         $options['mail']['smtpOptions'] = Configure::read('App.smtpOptions');
     }
     if (Common::isDevelopment()) {
         $options['mail']['delivery'] = 'debug';
     }
     App::import('Core', 'Controller');
     $Email = Common::getComponent('Email');
     Common::setProperties($Email, $options['mail']);
     if (!isset($Email->Controller)) {
         App::import('Core', 'Router');
         $Email->Controller = new AppController();
     }
     $Email->Controller->set($options['vars']);
     if ($options['store']) {
         $hash = sha1(json_encode($options));
         $folder = substr($hash, 0, 2);
         $file = substr($hash, 2) . '.html';
         $url = '/emails/' . $folder . '/' . $file;
         $path = APP . 'webroot' . $url;
         if (!is_dir(dirname($path))) {
             @mkdir(dirname($path));
         }
         $url = Router::url($url, true);
         $Email->Controller->set('emailUrl', $url);
         $View = new View($Email->Controller, false);
         $View->layout = $Email->layout;
         $View->layoutPath = 'email' . DS . 'html';
         $html = $View->element('email' . DS . 'html' . DS . $options['mail']['template'], array('content' => null), true);
         $html = $View->renderLayout($html);
         file_put_contents($path, $html);
     }
     if (!isset($Email->Controller->Session)) {
         $Email->Controller->Session = Common::getComponent('Session');
     }
     $result = $Email->send();
     if (Common::isDevelopment() && Configure::read('App.email_debug')) {
         Common::debugEmail();
     }
     return $result;
 }
Example #13
0
 function element($name, $data = array(), $options = false)
 {
     $element = parent::element($name, $data, $options);
     $hookContainer = ClassRegistry::getObject('HookContainer');
     $before = "";
     if ($hookContainer->getElementHook($name, true)) {
         $before = $this->element($hookContainer->getElementHook($name, true), $data, $options);
     }
     $after = "";
     if ($hookContainer->getElementHook($name)) {
         $after = $this->element($hookContainer->getElementHook($name), $data, $options);
     }
     return $before . $element . $after;
 }
 function element($name, $params = array(), $loadHelpers = false)
 {
     if (!is_array($name)) {
         return parent::element($name, $params, $loadHelpers);
     } else {
         $not_found_str = "Not Found";
         //debug($name);
         foreach ($name as $name) {
             $result = parent::element($name, $params, $loadHelpers);
             if ($result && substr($result, 0, strlen($not_found_str)) != $not_found_str) {
                 return $result;
             }
         }
         return $result;
     }
 }
Example #15
0
File: mi.php Project: hiromi2424/mi
 /**
  * Undo Mi logic when reporting an error for a missing view file
  *
  * @param mixed $name
  * @param array $params array()
  * @param bool $loadHelpers false
  * @return void
  * @access public
  */
 function element($name, $params = array(), $loadHelpers = false)
 {
     $return = parent::element($name, $params, $loadHelpers);
     if (strpos($return, 'Not Found:') === 0) {
         $plugin = null;
         if (isset($params['plugin'])) {
             $plugin = $params['plugin'];
         }
         if (isset($this->plugin) && !$plugin) {
             $plugin = $this->plugin;
         }
         $paths = $this->_paths($plugin);
         $path = array_pop($paths);
         while ($paths && strpos($path, DS . 'locale' . DS)) {
             $path = array_pop($paths);
         }
         $file = $path . 'elements' . DS . $name . $this->ext;
         return "Not Found: " . $file;
     }
     return $return;
 }
Example #16
0
 public function submit_all()
 {
     if ($this->validateAction()) {
         if ($this->permissions->canDeleteBlock() && $this->page->isMasterCollection()) {
             $name = sprintf('delete_block_%s', $this->block->getBlockID());
             $queue = \Queue::get($name);
             if ($_POST['process']) {
                 $obj = new \stdClass();
                 $messages = $queue->receive(20);
                 foreach ($messages as $key => $p) {
                     $block = unserialize($p->body);
                     $page = \Page::getByID($block['cID'], $block['cvID']);
                     $b = \Block::getByID($block['bID'], $page, $block['arHandle']);
                     if (is_object($b) && !$b->isError()) {
                         $b->deleteBlock();
                     }
                     $queue->deleteMessage($p);
                 }
                 $obj->totalItems = $queue->count();
                 if ($queue->count() == 0) {
                     $queue->deleteQueue($name);
                 }
                 $obj->bID = $this->block->getBlockID();
                 $obj->aID = $this->area->getAreaID();
                 $obj->message = t('All child blocks deleted successfully.');
                 echo json_encode($obj);
                 $this->app->shutdown();
             } else {
                 $queue = $this->block->queueForDefaultsUpdate($_POST, $queue);
             }
             $totalItems = $queue->count();
             \View::element('progress_bar', array('totalItems' => $totalItems, 'totalItemsSummary' => t2("%d block", "%d blocks", $totalItems)));
             $this->app->shutdown();
         }
     }
 }
 public function beforeRender(Controller $controller)
 {
     $q = '';
     $conditions = $this->conditions;
     $order = array();
     $order_selected = false;
     $useDefaults = true;
     $filters = array();
     $switchers = array();
     $orders = array();
     $controller->mode = 'dataobjectsBrowser';
     if (isset($controller->request->query['dataset']) && !empty($controller->request->query['dataset'])) {
         $dataset = is_array($controller->request->query['dataset']) ? $controller->request->query['dataset'][0] : $controller->request->query['dataset'];
         if ($dataset) {
             if ($this->mode == 'datachannel') {
                 $url = '/dane/' . $dataset;
                 if (isset($controller->request->query['q']) && $controller->request->query['q']) {
                     $url .= '?q=' . urlencode($controller->request->query['q']);
                 }
                 $controller->redirect($url);
                 exit;
             }
             $this->mode = 'dataset';
             $this->tag = $dataset;
         }
     }
     if (!$this->href) {
         $here = $controller->here;
         if ($p = strpos($here, '.')) {
             $here = substr($here, 0, $p);
         }
         /*
         $strlen = strlen($here);
         if( $here[ $strlen-1 ]=='/' )
             $here = substr($here, 0, $strlen-1);
         */
         $this->href = $here;
     }
     if ($this->mode == 'dataset') {
         $this->read_dataset_config($this->tag);
     }
     if (!empty($this->source)) {
         $source_parts = array();
         foreach ($this->source as $key => $value) {
             $source_parts[] = $key . ':' . $value;
         }
         $conditions['_source'] = implode(' ', $source_parts);
     }
     if (!isset($controller->request->query['order']) && isset($this->settings['order'])) {
         $controller->request->query['order'] = $this->settings['order'];
     }
     $query_keys = array_keys($controller->request->query);
     foreach ($query_keys as $key) {
         $value = $controller->request->query[$key];
         switch ($key) {
             case 'order':
                 $order_parts = explode(' ', $value);
                 $order = array('field' => $order_parts[0], 'direction' => isset($order_parts[1]) ? $order_parts[1] : 'desc');
                 $order['str'] = $order['field'] . ' ' . $order['direction'];
                 $this->hlFieldsPush = array($order['field']);
                 break;
             case 'q':
                 $q = $value;
                 if ($value) {
                     $orders[] = array('sorting' => array('field' => 'score', 'label' => 'Trafność', 'direction' => 'desc'));
                 }
                 break;
             case 'search':
                 $useDefaults = false;
                 break;
             case 'submit':
                 break;
             default:
                 $key = str_replace(':', '.', $key);
                 if (in_array($key, $this->excludeFilters)) {
                     continue;
                 }
                 if (array_key_exists($key, $conditions) && $conditions[$key] != $value) {
                     $conditions[$key][] = $value;
                 } else {
                     $conditions[$key] = $value;
                 }
         }
     }
     if ($this->mode == 'dataset') {
         $conditions['dataset'] = $this->tag;
         $dataset = $controller->API->getDataset($this->tag, array('full' => true));
         if ($dataset) {
             $this->dataset = $dataset;
             foreach ($this->excludeFilters as &$ef) {
                 if (strpos($ef, '.') === false) {
                     $ef = $this->tag . '.' . $ef;
                 }
             }
             if (!$this->title) {
                 $this->title = $dataset['Dataset']['name'];
             }
             // ŁADOWANIE SORTOWAŃ
             $orders = array_merge($orders, $dataset['orders']);
             if (isset($order['field'])) {
                 foreach ($orders as &$_order) {
                     if ($_order['sorting']['field'] == $order['field']) {
                         $this->hlFieldsPush = $order['field'];
                         $_order['selected_direction'] = $order['direction'];
                         $order_selected = true;
                         break;
                     }
                 }
             }
             // ŁADOWANIE PRZEŁĄCZNIKÓW
             $switchers = $dataset['switchers'];
             if ($useDefaults && !empty($switchers)) {
                 foreach ($switchers as $switcher) {
                     $switcher = $switcher['switcher'];
                     if ($switcher['dataset_search_default'] == '1') {
                         $conditions['!' . $switcher['name']] = '1';
                     }
                 }
             }
             // ŁADOWANIE FILTRÓW
             $filters = $dataset['filters'];
             if (!empty($filters)) {
                 $_filters = array();
                 foreach ($filters as $filter) {
                     if (!in_array($filter['filter']['field'], $this->excludeFilters)) {
                         $_filters[] = $filter;
                     }
                 }
                 $filters = $_filters;
             }
         }
     } elseif ($this->mode == 'datachannel') {
         $datachannel = $controller->API->getDatachannel($this->tag, array('full' => true));
         $this->datachannel = $datachannel;
         $datachannel = $datachannel['Datachannel'];
         $this->title = $datachannel['name'];
         // $data = $controller->API->getDatachannel($this->tag);
         // $datachannel = $data['Datachannel'];
         $conditions['datachannel'] = $datachannel['slug'];
         $title_for_layout = $datachannel['name'];
         $filters[] = array('filter' => array('field' => 'dataset', 'typ_id' => '2', 'parent_field' => false, 'label' => 'Zbiory danych:', 'desc' => false, 'multi' => '0'));
         $orders[] = array('sorting' => array('field' => 'date', 'label' => 'Data', 'direction' => 'desc'));
     } else {
         $filters[] = array('filter' => array('field' => 'dataset', 'typ_id' => '5', 'parent_field' => false, 'label' => 'Zbiory danych:', 'desc' => false, 'multi' => '0', 'dictionary' => $this->dataset_dictionary));
     }
     // ŁADOWANIE OBIEKTÓW
     // $controller->Dataobject = ClassRegistry::init('Dane.Dataobject');
     $controller->loadModel('Dane.Dataobject');
     $queryData = array('q' => $q, 'conditions' => $conditions, 'paramType' => 'querystring', 'facets' => true, 'limit' => $this->limit);
     // debug( $queryData );
     if (empty($order) && !empty($orders)) {
         $order = array('field' => $orders[0]['sorting']['field'], 'direction' => $orders[0]['sorting']['direction'], 'str' => $orders[0]['sorting']['field'] . ' ' . $orders[0]['sorting']['direction']);
     }
     if (!$order_selected && !empty($order)) {
         foreach ($orders as &$o) {
             if ($o['sorting']['field'] == $order['field']) {
                 $this->hlFieldsPush = $order['field'];
                 $o['selected_direction'] = $order['direction'];
             }
         }
     }
     if (!empty($order)) {
         $queryData['order'] = $order['str'];
     }
     $this->Paginator->settings = $queryData;
     $objects = $this->Paginator->paginate('Dataobject');
     $pagination = $controller->Dataobject->pagination;
     $pagination['page'] = (int) @$controller->request->query['page'];
     if (!$pagination['page']) {
         $pagination['page'] = 1;
     }
     $facets = $controller->Dataobject->facets;
     $didyoumean = $controller->Dataobject->didyoumean;
     $total = $controller->Dataobject->total;
     if (isset($controller->request->query)) {
         $controller->data = array('Dataset' => $controller->request->query);
     }
     if (empty($this->excludeFilters)) {
         $emptyFilters = empty($filters) && empty($switchers);
     } else {
         $_filters = array();
         foreach ($filters as $f) {
             if (!in_array($f['filter']['field'], $this->excludeFilters)) {
                 $_filters[] = $f;
             }
         }
         $emptyFilters = empty($_filters) && empty($switchers);
     }
     $page = array('title' => $this->title, 'href' => $this->href, 'mode' => $this->mode, 'tag' => $this->tag, 'datasetLocked' => $this->datasetLocked, 'showTitle' => $this->showTitle, 'titleTag' => $this->titleTag, 'noResultsTitle' => $this->noResultsTitle, 'back' => $this->back, 'backTitle' => $this->backTitle);
     $config = $this->config;
     if (@$controller->request->params['ext'] == 'json') {
         $view = new View($controller, false);
         $objects = $view->element('Dane.DataobjectsBrowser/objects', array_merge(compact('objects', 'page', 'defaults', 'emptyFilters'), array('dataBrowser' => $this, 'defaults' => $config['defaults'], 'renderFile' => $this->renderFile, 'class' => $this->class)));
         $header = $view->element('Dane.DataobjectsBrowser/header', array_merge(compact('pagination', 'orders', 'page', 'didyoumean', 'emptyFilters'), array('controlls' => $config['controlls'])));
         $filters = $view->element('Dane.DataobjectsBrowser/filters', array_merge(compact('conditions', 'filters', 'switchers', 'facets', 'page', 'emptyFilters'), array('dataBrowser' => $this)));
         $pagination = $view->element('Dane.DataobjectsBrowser/pagination', compact('pagination'));
         $controller->set(compact('objects', 'header', 'filters', 'pagination'));
         $controller->set('_serialize', array('objects', 'header', 'filters', 'pagination'));
     } else {
         $path = App::path('View', 'Dane');
         $path = $path[0] . $controller->viewPath . '/' . $controller->view . '.ctp';
         $controller->view = $this->getViewPath();
         if (file_exists($path)) {
             $controller->set('originalViewPath', $path);
         }
         $controller->set(array_merge(compact('conditions', 'objects', 'pagination', 'orders', 'filters', 'didyoumean', 'total', 'facets', 'page', 'title_for_layout', 'switchers', 'q', 'emptyFilters'), array('renderFile' => $this->renderFile, 'class' => $this->class, 'dataBrowser' => $this)));
     }
 }
Example #18
0
 /**
  * Renders a layout. Returns output from _render(). Returns false on error.
  *
  * @param string $content_for_layout Content to render in a view, wrapped by the surrounding layout.
  * @return mixed Rendered output, or false on error
  */
 function renderLayout($content_for_layout, $layout = null)
 {
     $layoutFileName = $this->_getLayoutFileName($layout);
     if (empty($layoutFileName)) {
         return $this->output;
     }
     $debug = '';
     if (isset($this->viewVars['cakeDebug']) && Configure::read() > 2) {
         $params = array('controller' => $this->viewVars['cakeDebug']);
         $debug = View::element('dump', $params, false);
         unset($this->viewVars['cakeDebug']);
     }
     if ($this->pageTitle !== false) {
         $pageTitle = $this->pageTitle;
     } else {
         $pageTitle = Inflector::humanize($this->viewPath);
     }
     $data_for_layout = array_merge($this->viewVars, array('title_for_layout' => $pageTitle, 'content_for_layout' => $content_for_layout, 'scripts_for_layout' => join("\n\t", $this->__scripts), 'cakeDebug' => $debug));
     if (empty($this->loaded) && !empty($this->helpers)) {
         $loadHelpers = true;
     } else {
         $loadHelpers = false;
         $data_for_layout = array_merge($data_for_layout, $this->loaded);
     }
     $this->_triggerHelpers('beforeLayout', 'beforeSmartyLayout');
     if (substr($layoutFileName, -3) === 'ctp' || substr($layoutFileName, -5) === 'thtml') {
         $this->output = View::_render($layoutFileName, $data_for_layout, $loadHelpers, true);
     } else {
         $this->output = $this->_render($layoutFileName, $data_for_layout, $loadHelpers, true);
     }
     if ($this->output === false) {
         $this->output = $this->_render($layoutFileName, $data_for_layout);
         $msg = __("Error in layout %s, got: <blockquote>%s</blockquote>", true);
         trigger_error(sprintf($msg, $layoutFileName, $this->output), E_USER_ERROR);
         return false;
     }
     $this->_triggerHelpers('afterLayout', 'afterSmartyLayout');
     return $this->output;
 }
Example #19
0
            echo $publishTitle;
            ?>
</button>
                        </li>
                    </ul>
                <?php 
        }
        ?>
            </div>
        </nav>

        <div id="ccm-stack-container">
            <?php 
        $a = Area::get($stackToEdit, STACKS_AREA_NAME);
        $a->forceControlsToDisplay();
        View::element('block_area_header', array('a' => $a));
        foreach ($blocks as $b) {
            $bv = new BlockView($b);
            $bv->setAreaObject($a);
            $p = new Permissions($b);
            if ($p->canViewBlock()) {
                $bv->render('view');
            }
        }
        //View::element('block_area_footer', array('a' => $a));
        print '</div>';
        // No, we don't include the footer because we don't want all area controls available.
        // But the footer element has a closing DIV we need.
        ?>
        </div>
Example #20
0
/**
 * Outputs the contents of the queries log. If in a non-CLI environment the sql_log element
 * will be rendered and output.  If in a CLI environment, a plain text log is generated.
 *
 * @param boolean $sorted Get the queries sorted by time taken, defaults to false.
 * @return void
 */
	public function showLog($sorted = false) {
		$log = $this->getLog($sorted, false);
		if (empty($log['log'])) {
			return;
		}
		if (PHP_SAPI != 'cli') {
			$controller = null;
			$View = new View($controller, false);
			$View->set('logs', array($this->configKeyName => $log));
			echo $View->element('sql_dump', array('_forced_from_dbo_' => true));
		} else {
			foreach ($log['log'] as $k => $i) {
				print (($k + 1) . ". {$i['query']}\n");
			}
		}
	}
Example #21
0
 /**
  * Render an element
  *
  * @param string $name Element Name
  * @param array $params Parameters
  * @param boolean $callbacks Fire callbacks
  * @return string
  */
 public function element($name, $params = array(), $callbacks = false)
 {
     // email hack
     if (substr($name, 0, 5) != 'email') {
         $this->ext = '.ctp';
         // not an email, use .ctp
     }
     $return = parent::element($name, $params, $callbacks);
     $this->ext = '.tpl';
     return $return;
 }
Example #22
0
<?php

if (Request::getInstance()->get('_ccm_dashboard_external')) {
    return;
}
?>
</div>
</div>

<?php 
View::element('footer_required', array('disableTrackingCode' => true));
?>
<script type="text/javascript">
	ConcretePanelManager.register({'overlay': false, 'identifier': 'dashboard', 'position': 'right', url: '<?php 
echo URL::to("/ccm/system/panels/dashboard");
?>
'});
	ConcretePanelManager.register({'identifier': 'sitemap', 'position': 'right', url: '<?php 
echo URL::to("/ccm/system/panels/sitemap");
?>
'});
    <?php 
if (!(isset($hideDashboardPanel) && $hideDashboardPanel)) {
    ?>
        var panel = ConcretePanelManager.getByIdentifier('dashboard');
        panel.isOpen = true;
        panel.onPanelLoad();
    <?php 
}
?>
    $canApprovePageVersions = $cp->canApprovePageVersions();
    $u = new User();
    $username = $u->getUserName();
    $vo = $c->getVersionObject();
    $pageInUseBySomeoneElse = false;
    if ($c->isCheckedOut()) {
        if (!$c->isCheckedOutByMe()) {
            $pageInUseBySomeoneElse = true;
        }
    }
    if (!$c->isEditMode()) {
        print Core::make('helper/concrete/ui/help')->displayHelpDialogLauncher();
    }
    $cih = Core::make("helper/concrete/ui");
    if ($cih->showHelpOverlay()) {
        View::element('help/dialog/introduction');
        $v = View::getInstance();
        $v->addFooterItem('<script type="text/javascript">$(function() { new ConcreteHelpDialog().open(); });</script>');
        $cih->trackHelpOverlayDisplayed();
    }
    ?>

    <div id="ccm-page-controls-wrapper" class="ccm-ui">
    <div id="ccm-toolbar" class="<?php 
    echo $show_titles ? 'titles' : '';
    ?>
 <?php 
    echo $large_font ? 'large-font' : '';
    ?>
">
    <div class="ccm-mobile-menu-overlay">
Example #24
0
<?php

defined('C5_EXECUTE') or die("Access Denied.");
$view->inc('elements/header.php');
?>

<div class="container">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<?php 
View::element('system_errors', array('format' => 'block', 'error' => isset($error) ? $error : null, 'success' => isset($success) ? $success : null, 'message' => isset($message) ? $message : null));
?>
</div>
</div>

<?php 
echo $innerContent;
?>

</div>
</div>

<?php 
$view->inc('elements/footer.php');
Example #25
0
 public function ajaxGetContent($pageVal = "")
 {
     if ($pageVal != "") {
         $this->layout = null;
         $this->autoRender = false;
         $view = new View($this, false);
         $params = array();
         $content = $view->element($pageVal, $params);
         echo $content;
     }
 }
 /**
  * test that additional element viewVars don't get overwritten with helpers.
  *
  * @return void
  */
 function testElementParamsDontOverwriteHelpers()
 {
     $Controller = new ViewPostsController();
     $Controller->helpers = array('Form');
     $View = new View($Controller);
     $result = $View->element('type_check', array('form' => 'string'), true);
     $this->assertEqual('string', $result);
     $View->set('form', 'string');
     $result = $View->element('type_check', array(), true);
     $this->assertEqual('string', $result);
 }
Example #27
0
 /**
  * testElementCacheHelperNoCache method
  *
  * @access public
  * @return void
  */
 function testElementCacheHelperNoCache()
 {
     $Controller = new ViewPostsController();
     $View = new View($Controller);
     $empty = array();
     $helpers = $View->_loadHelpers($empty, array('cache'));
     $View->loaded = $helpers;
     $result = $View->element('test_element', array('ram' => 'val', 'test' => array('foo', 'bar')));
     $this->assertEqual($result, 'this is the test element');
 }
Example #28
0
?>

    <a href="<?php 
echo URL::to('/dashboard/system/express/entities/associations', 'add', $entity->getId());
?>
" class="btn btn-primary">
        <?php 
echo t("Add Association");
?>
    </a>

</div>

<div class="row">
    <?php 
View::element('dashboard/express/detail_navigation', array('entity' => $entity));
?>
    <div class="col-md-8">

        <?php 
if (count($associations)) {
    ?>

            <ul class="item-select-list" id="ccm-stack-list">
                <?php 
    foreach ($associations as $association) {
        $formatter = $association->getFormatter();
        ?>

                    <li>
                        <a href="<?php 
Example #29
0
 /**
  * Test memory leaks that existed in _paths at one point.
  *
  * @return void
  */
 public function testMemoryLeakInPaths()
 {
     $this->ThemeController->plugin = null;
     $this->ThemeController->name = 'Posts';
     $this->ThemeController->viewPath = 'posts';
     $this->ThemeController->layout = 'whatever';
     $this->ThemeController->theme = 'TestTheme';
     $View = new View($this->ThemeController);
     $View->element('test_element');
     $start = memory_get_usage();
     for ($i = 0; $i < 10; $i++) {
         $View->element('test_element');
     }
     $end = memory_get_usage();
     $this->assertLessThanOrEqual($start + 5000, $end);
 }
Example #30
0
<?php

defined('C5_EXECUTE') or die("Access Denied.");
?>

<div data-search="express_entries" class="ccm-ui">
    <?php 
View::element('express/entries/search', array('controller' => $searchController, 'selectMode' => true));
?>
</div>

<script type="text/javascript">
    $(function () {
        $('div[data-search=express_entries]').concreteAjaxSearch({
            result: <?php 
echo $result;
?>
        });
    });
</script>