本文整理汇总了PHP中ViewFactory类的典型用法代码示例。如果您正苦于以下问题:PHP ViewFactory类的具体用法?PHP ViewFactory怎么用?PHP ViewFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ViewFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: make_view
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;
}
示例2: parse
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;
}
示例3: __viewIndex
/**
* 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);
}
示例4: execute
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();
}
示例5: __construct
public function __construct()
{
$this->addonName = $this->getAddonName();
$this->addonPath = APP_ADDON_PATH . $this->addonName . '/';
$this->configFile = $this->addonPath . 'config.php';
$this->view = ViewFactory::factory();
}
示例6: execute
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();
}
示例7: execute
public function execute()
{
$datahandler = DatahandlerFactory::create('D_ReadAllRoles');
$data = $datahandler->getOutData();
$view = ViewFactory::create('V_SelectRoleToAssignActions');
$view->setInData($data);
$view->display();
}
示例8: execute
public function execute()
{
$session = SessionFactory::create();
$session->destroy();
$view = ViewFactory::create('V_Logout');
$view->display();
exit;
}
示例9: getView
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);
}
示例10: test_buildClass
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);
}
示例11: __construct
/**
* 构造函数
*/
public function __construct()
{
Hook::listen('CONTROLLER_START', $this->options);
//视图对象
$this->view = ViewFactory::factory();
//子类如果存在auto方法,自动运行
if (method_exists($this, "__init")) {
$this->__init();
}
}
示例12: testShowSubpanelsSettingForPrint
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');
}
示例13: execute
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();
}
示例14: __construct
public function __construct()
{
/**
* 视图对象
*/
$this->view = ViewFactory::factory();
$this->setAddonConfig();
if (method_exists($this, '__init')) {
$this->__init();
}
}
示例15: execute
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();
}