Ejemplo n.º 1
0
 static function make_view($template, $layout = false)
 {
     # get the template type
     $template = PROJECT_VIEWS . '/' . $template;
     $type = ViewFactory::get_template_type($template);
     if ($type === false) {
         throw new MissingTemplate("No recognizable template was found at {$template}.");
     }
     # return the right view depending on the extension of the template
     switch ($type) {
         case 'phtml':
             $the_view = new PHTMLView("{$template}.{$type}");
             break;
         case 'pxml':
             $the_view = new PXMLView("{$template}.{$type}");
             break;
         case 'pjs':
             $the_view = new PJSView("{$template}.{$type}");
             break;
         case 'xsl':
             $the_view = new XSLTView("{$template}.{$type}");
             break;
         default:
             throw new UnknownViewType("ViewFactory doesn't know how to use a {$type} file.");
     }
     return $the_view;
 }
Ejemplo n.º 2
0
 function parse($layout_template = false)
 {
     parent::parse($layout_template);
     # unpack the props
     #extract($this->props);
     # trap the buffer
     ob_start();
     # include the template
     include $this->template;
     # get the buffer contents
     $parsed = ob_get_contents();
     # clean the buffer
     ob_clean();
     # if there is a layout
     if ($this->layout) {
         # find the type
         $type = ViewFactory::get_template_type($layout_template);
         if ($type) {
             # push the content into the layout
             $content_for_layout = $parsed;
             # include the template
             include $this->layout . ".{$type}";
             # get the buffer contents
             $parsed = ob_get_contents();
         }
     }
     # close the output buffer
     ob_end_clean();
     # save the result
     $this->parsed = $parsed;
     return $parsed;
 }
 /**
  * Builds the content view
  */
 public function __viewIndex()
 {
     $title = $this->_tables[$this->_curColor];
     $this->setPageType('table');
     $this->setTitle(sprintf('%1$s: %2$s – %3$s', extension_anti_brute_force::EXT_NAME, $title, __('Symphony')));
     $this->addStylesheetToHead(URL . '/extensions/anti_brute_force/assets/content.abf.css', 'screen', time() + 10);
     $this->appendSubheading(__($title));
     $cols = $this->getCurrentCols();
     // build header table
     $aTableHead = ViewFactory::buildTableHeader($cols);
     // build body table
     $aTableBody = ViewFactory::buildTableBody($cols, $this->getData());
     // build data table
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'selectable', null, array('role' => 'directory', 'aria-labelledby' => 'symphony-subheading', 'data-interactive' => 'data-interactive'));
     // build the color select box
     $this->Context->appendChild(ViewFactory::buildSubMenu($this->_tables, $this->_curColor, 'switch'));
     // append table
     $this->Form->appendChild($table);
     // insert form
     $insertLine = $this->buildInsertForm();
     // append actions
     $insertLine->appendChild(ViewFactory::buildActions($this->_hasData));
     // append the insert line
     $this->Form->appendChild($insertLine);
 }
 public function execute()
 {
     //SESSION
     $session = SessionFactory::create();
     $date = $session->get("selected-date");
     //VALIDATION
     $validator = ValidatorFactory::create();
     $validator->ifTrue($date == null)->respond(INCOMPLETE_FILTER_DATA);
     //SESSION DATA
     $sessionData = array('date' => $date);
     //PARAMETERS
     $params = RequestParametersFactory::create();
     $pageNumber = $params->get('page-number');
     $rowsPerPage = $params->get('rows-per-page');
     //PAGINATOR
     $paginator = PaginatorFactory::create();
     $paginator->pageNumber = $pageNumber;
     $datahandler = DatahandlerFactory::create('D_ClientRequestsRowsTotalNumber');
     $datahandler->setInData($sessionData);
     $rowsTotalNumber = $datahandler->getOutData();
     //Always force a single page
     $paginator->rowsPerPage = $rowsTotalNumber;
     //DATAHANDLERS
     $datahandler = DatahandlerFactory::create('D_FrequencyTableOfClientRequests');
     $datahandler->setInData($sessionData);
     $data = $datahandler->getOutData();
     //VALIDATION
     $validator->ifTrue($data == array())->respond('No activity for the day: ' . $date);
     //PAGINATOR
     $paginator->rowsTotalNumber = $rowsTotalNumber;
     //VIEW
     $view = ViewFactory::create('V_FrequencyTableOfClientRequests');
     $view->setInData($data);
     $view->display();
 }
Ejemplo n.º 5
0
 public function __construct()
 {
     $this->addonName = $this->getAddonName();
     $this->addonPath = APP_ADDON_PATH . $this->addonName . '/';
     $this->configFile = $this->addonPath . 'config.php';
     $this->view = ViewFactory::factory();
 }
 public function execute()
 {
     //PARAMETERS
     $params = RequestParametersFactory::create();
     $roleId = $params->get('selected-role-id');
     $pageNumber = $params->get('page-number');
     $rowsPerPage = $params->get('rows-per-page');
     //PAGINATOR
     $paginator = PaginatorFactory::create();
     $paginator->pageNumber = $pageNumber;
     $datahandler = DatahandlerFactory::create('D_ActionsRowsTotalNumber');
     $actionsRowsTotalNumber = $datahandler->getOutData();
     $paginator->rowsPerPage = $actionsRowsTotalNumber;
     //Always force a single page
     $paginator->rowsPerPage = $actionsRowsTotalNumber;
     //SESSION
     $session = SessionFactory::create();
     $session->set('selected-role-id', $roleId);
     //DATAHANDLER
     $datahandler = DatahandlerFactory::create('D_ReadActionsWithStatus');
     $datahandler->setInData($roleId);
     $roleActions = $datahandler->getOutData();
     //DATAHANDLER
     $datahandler = DatahandlerFactory::create('D_ReadRoleById');
     $datahandler->setInData($roleId);
     $roleData = $datahandler->getOutData();
     //SESSION
     $session->set('selected-role-name', $roleData['name']);
     $data = array('role-actions' => $roleActions, 'role-name' => $roleData['name']);
     //VIEW
     $view = ViewFactory::create('V_ReadActionsWithStatus');
     $view->setInData($data);
     $view->display();
 }
 public function execute()
 {
     $datahandler = DatahandlerFactory::create('D_ReadAllRoles');
     $data = $datahandler->getOutData();
     $view = ViewFactory::create('V_SelectRoleToAssignActions');
     $view->setInData($data);
     $view->display();
 }
 public function execute()
 {
     $session = SessionFactory::create();
     $session->destroy();
     $view = ViewFactory::create('V_Logout');
     $view->display();
     exit;
 }
Ejemplo n.º 9
0
 public function getView($viewName)
 {
     if (strpos($viewName, '::') !== false) {
         list($module, $viewName) = explode('::', $viewName);
     } else {
         $module = ucfirst($this->response->request->module);
     }
     return ViewFactory::get($viewName, $module);
 }
Ejemplo n.º 10
0
 public function test_buildClass()
 {
     //checck with valid values and test if it returns correct view instance
     $view = ViewFactory::_buildClass('UsersViewList', null, array());
     $this->assertInstanceOf('UsersViewList', $view);
     //checck with valid values and test if it returns correct view instance
     $view = ViewFactory::_buildClass('UsersViewDetail', null, array());
     $this->assertInstanceOf('UsersViewDetail', $view);
 }
 public function execute()
 {
     //DATAHANDLER
     $datahandler = DatahandlerFactory::create('D_ClientRequestFrequencyLinePlot');
     $data = $datahandler->getOutData();
     //VIEW
     $view = ViewFactory::create('V_ClientRequestFrequencyLinePlot');
     $view->setInData($data);
     $view->display();
 }
 public function execute()
 {
     //DATAHANDLER
     $datahandler = DatahandlerFactory::create('D_ReadAllRoles');
     $data = $datahandler->getOutData();
     //VIEW
     $view = ViewFactory::create('V_ReadAllRoles');
     $view->setInData($data);
     $view->display();
 }
Ejemplo n.º 13
0
 /**
  * 构造函数
  */
 public function __construct()
 {
     Hook::listen('CONTROLLER_START', $this->options);
     //视图对象
     $this->view = ViewFactory::factory();
     //子类如果存在auto方法,自动运行
     if (method_exists($this, "__init")) {
         $this->__init();
     }
 }
Ejemplo n.º 14
0
 public function testShowSubpanelsSettingForPrint()
 {
     $viewClass = 'ViewDetail';
     $type = 'detail';
     $view = new $viewClass();
     $view->module = 'Cases';
     ViewFactory::_loadConfig($view, $type);
     $_REQUEST['print'] = true;
     $view->preDisplay();
     $this->assertFalse($view->options['show_subpanels'], 'show_subpanels should be false for print');
 }
 public function execute()
 {
     $params = RequestParametersFactory::create();
     $name = $params->get('search-target');
     $datahandler = DatahandlerFactory::create('D_SearchUsersByName');
     $datahandler->setInData($name);
     $data = $datahandler->getOutData();
     $view = ViewFactory::create('V_ReadAllUsers');
     $view->setInData($data);
     $view->display();
 }
Ejemplo n.º 16
0
 public function __construct()
 {
     /**
      * 视图对象
      */
     $this->view = ViewFactory::factory();
     $this->setAddonConfig();
     if (method_exists($this, '__init')) {
         $this->__init();
     }
 }
 public function execute()
 {
     //DATAHANDLER
     $datahandler = DatahandlerFactory::create('D_ReadClientIps');
     $clientIps = $datahandler->getOutData();
     $datahandler = DatahandlerFactory::create('D_ReadDates');
     $dates = $datahandler->getOutData();
     $data = array("client-ips" => $clientIps, "dates" => $dates);
     //VIEW
     $view = ViewFactory::create('V_EnterFilterDataForm');
     $view->setInData($data);
     $view->display();
 }
Ejemplo n.º 18
0
 private function processView()
 {
     $view = ViewFactory::loadView($this->view, $this->module, $this->bean, $this->view_object_map, $this->target_module);
     $GLOBALS['current_view'] = $view;
     if (!empty($this->bean) && !$this->bean->ACLAccess($view->type) && $view->type != 'list') {
         ACLController::displayNoAccess(true);
         sugar_cleanup(true);
     }
     if (isset($this->errors)) {
         $view->errors = $this->errors;
     }
     $view->process();
 }
Ejemplo n.º 19
0
 protected function setUp()
 {
     $view_factory = new ViewFactory();
     $this->view = $view_factory->newInstance();
     $helpers = $this->view->getHelpers();
     $helpers->set('hello', function ($name) {
         return "Hello {$name}!";
     });
     $view_registry = $this->view->getViewRegistry();
     $view_registry->set('index', function () {
         echo $this->hello($this->name);
     });
     $view_registry->set('master', function () {
         foreach (array('bar', 'baz', 'dib') as $foo) {
             echo $this->render('_partial', array('foo' => $foo));
         }
     });
     $view_registry->set('_partial', function (array $vars) {
         extract($vars);
         echo "foo = {$foo}" . PHP_EOL;
     });
     $view_registry->set('sections', function () {
         $this->setSection('foo', 'foo bar baz');
         $this->beginSection('dib');
         echo "dib zim gir";
         $this->endSection();
     });
     $layout_registry = $this->view->getLayoutRegistry();
     $layout_registry->set('default', function () {
         echo "before -- " . $this->getContent() . " -- after";
     });
     $layout_registry->set('sections', function () {
         echo $this->getSection('foo') . ' ';
         echo $this->getSection('dib') . ' ';
         if (!$this->hasSection('doom')) {
             echo 'irk';
         }
     });
 }
Ejemplo n.º 20
0
 /**
  * 构造函数
  */
 public function __construct()
 {
     Hook::listen('CONTROLLER_START', $this->options);
     /**
      * 视图对象
      */
     $this->view = ViewFactory::factory();
     /**
      * 自动运行的魔术方法
      */
     if (method_exists($this, "__init")) {
         $this->__init();
     }
 }
Ejemplo n.º 21
0
 /**
  * 返回工厂实例,单例模式
  */
 public static function factory($driver = null)
 {
     //只实例化一个对象
     if (is_null(self::$viewFactory)) {
         self::$viewFactory = new viewFactory();
     }
     if (is_null($driver)) {
         $driver = ucfirst(strtolower(C("TPL_ENGINE")));
     }
     if (isset(self::$viewFactory->driverList[$driver])) {
         return self::$viewFactory->driverList[$driver];
     }
     self::$viewFactory->getDriver($driver);
     return self::$viewFactory->driverList[$driver];
 }
 public function execute()
 {
     //PARAMETERS
     $params = RequestParametersFactory::create();
     //SESSION
     $session = SessionFactory::create();
     $datahandler = DatahandlerFactory::create('D_SearchActionsByName');
     $data = array('selected-role-id' => $session->get('selected-role-id'), 'search-action-name' => $params->get('search-target'));
     $datahandler->setInData($data);
     $roleActions = $datahandler->getOutData();
     $data = array('role-actions' => $roleActions, 'role-name' => $session->get('selected-role-name'));
     $view = ViewFactory::create('V_ReadActionsWithStatus');
     $view->setInData($data);
     $view->display();
 }
 public function execute()
 {
     $params = RequestParametersFactory::create();
     $id = $params->get('role-id');
     // $validator = ValidatorFactory::create();
     // $validator->ifFalse(is_integer($id))->respond(NOT_VALID_ID);
     $session = SessionFactory::create();
     $session->set('role-id', $id);
     $datahandler = DatahandlerFactory::create('D_ReadRoleById');
     $datahandler->setInData($id);
     $data = $datahandler->getOutData();
     $view = ViewFactory::create('V_UpdateRoleForm');
     $view->setInData($data);
     $view->display();
 }
Ejemplo n.º 24
0
 /**
  * Returns the view to display.
  * 
  * @return string
  * @todo select view instance based on controller name
  */
 public function getView($controllerName, $result)
 {
     // On redirect, load default view object and tell it to redirect.
     if (isset($this->redirects[$controllerName][$result])) {
         $view = $this->viewFactory->getView();
         $view->setRedirect($this->redirects[$controllerName][$result]);
         return $view;
     }
     // If no view script is configured, we don't know what to do.
     if (!isset($this->views[$controllerName][$result])) {
         throw new Exception('Controller "' . $controllerName . '" result "' . $result . '" has no view script');
     }
     // Get the "real" view object (depending on the view script).
     $view = $this->viewFactory->getView($this->views[$controllerName][$result]);
     return $view;
 }
 public function execute()
 {
     $params = RequestParametersFactory::create();
     $id = $params->get('user-id');
     $validator = ValidatorFactory::create();
     $validator->ifTrue($id == "1")->respond(NOT_DELETE_ADMIN);
     $session = SessionFactory::create();
     $session->set('user-id', $id);
     $datahandler = DatahandlerFactory::create('D_ReadUserById');
     $datahandler->setInData($id);
     $data = $datahandler->getOutData();
     $view = ViewFactory::create('V_DeleteUserConfirmation');
     $view->setInData($data);
     $view->display();
     unset($datahandler, $view);
 }
Ejemplo n.º 26
0
 /**
  * 构造函数
  */
 public function __construct()
 {
     Hook::listen('CONTROLLER_START', $this->options);
     $this->addonName = $this->getAddonName();
     $this->addonPath = APP_ADDON_PATH . $this->addonName . '/';
     $this->configFile = $this->addonPath . 'config.php';
     /**
      * 视图对象
      */
     $this->view = ViewFactory::factory();
     /**
      * 自动运行的魔术方法
      */
     if (method_exists($this, "__init")) {
         $this->__init();
     }
 }
Ejemplo n.º 27
0
 public function indexAction()
 {
     /* Once upon a time $shapes was extracted from $_REQUEST and successfully validated.
      *   And now $shapes is array like this:
      *   $shapes = [
      *       ['type' => 'circle', 'params' => [...]],
      *       ['type' => 'circle', 'params' => [...]]
      *   ];
      *
      *   We believe in it.
      */
     $shapes = Request::getShapes();
     $shapes = new ShapesCollection($shapes);
     $view = ViewFactory::getView(Request::getViewType());
     while ($shape = $shapes->getShape()) {
         $view->assignShape($shape);
     }
     $view->render();
 }
 /**
  * Builds the content view
  */
 public function __viewIndex()
 {
     // Get data
     $this->_data = ABF::instance()->getFailures('IP ASC');
     $this->_hasData = is_array($this->_data) && count($this->_data) > 0;
     // Build the page
     $title = __('Banned IPs');
     $this->setPageType('table');
     $this->setTitle(__('%1$s – %2$s', array(__('Symphony'), $title)));
     $this->appendSubheading(__($title));
     // build header table
     $aTableHead = ViewFactory::buildTableHeader($this->_cols);
     // build body table
     $aTableBody = ViewFactory::buildTableBody($this->_cols, $this->_data);
     // build data table
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'selectable', null, array('role' => 'directory', 'aria-labelledby' => 'symphony-subheading', 'data-interactive' => 'data-interactive'));
     $this->Form->appendChild($table);
     $this->Form->appendChild(ViewFactory::buildActions($this->_hasData));
 }
Ejemplo n.º 29
0
 function display()
 {
     global $mod_strings, $export_module, $current_language, $theme, $current_user;
     echo get_module_title("Activities", $mod_strings['LBL_MODULE_TITLE'], true);
     $mod_strings = return_module_language($current_language, 'Calls');
     // Overload the export module since the user got here by clicking the "Activities" tab
     $export_module = "Calls";
     $_REQUEST['module'] = 'Calls';
     $controller = ControllerFactory::getController('Calls');
     $controller->loadBean();
     $controller->preProcess();
     $controller->process();
     //Manipulate view directly to not display header, js and footer again
     $view = ViewFactory::loadView($controller->view, $controller->module, $controller->bean, $controller->view_object_map);
     $view->options['show_header'] = false;
     $view->options['show_title'] = false;
     $view->options['show_javascript'] = false;
     $view->process();
     die;
 }
 public function execute()
 {
     //PARAMETERS
     $params = RequestParametersFactory::create();
     $pageNumber = $params->get('page-number');
     $rowsPerPage = $params->get('rows-per-page');
     $paginator = PaginatorFactory::create();
     $paginator->pageNumber = $pageNumber;
     $paginator->rowsPerPage = $rowsPerPage;
     //DATAHANDLERS
     $datahandler = DatahandlerFactory::create('D_ReadRolesPaginated');
     $roles = $datahandler->getOutData();
     $datahandler = DatahandlerFactory::create('D_RolesRowsTotalNumber');
     $roleRowsTotalNumber = $datahandler->getOutData();
     $paginator->rowsTotalNumber = $roleRowsTotalNumber;
     //VIEW
     $view = ViewFactory::create('V_ReadRolesPaginated');
     $view->setInData(array("roles" => $roles));
     $view->display();
 }