示例#1
0
 public function __construct()
 {
     global $config, $tmpl;
     if ($config->isResetDataPermitted()) {
         $tmpl->assign('reset_data_is_permitted', true);
     }
     parent::__construct();
     return true;
 }
示例#2
0
文件: UploadView.php 项目: unki/mtlda
 public function __construct()
 {
     global $config;
     if (!$config->isHttpUploadEnabled()) {
         static::raiseError(__CLASS__ . ', HTTP uploading is not enabled in configuration!', true);
         return false;
     }
     parent::__construct();
     return true;
 }
示例#3
0
文件: MainView.php 项目: unki/mtlda
 public function __construct()
 {
     global $tmpl;
     $tmpl->registerPlugin("block", "top10", array(&$this, 'showTop10List'));
     if (!$this->load()) {
         static::raiseError(__CLASS__ . ', load() returned false!');
         return false;
     }
     parent::__construct();
     return true;
 }
示例#4
0
 public function showEdit($id, $guid)
 {
     global $tmpl;
     try {
         $item = new \MasterShaper\Models\ProtocolModel(array('idx' => $id, 'guid' => $guid));
     } catch (\Exception $e) {
         static::raiseError(__METHOD__ . '(), failed to load ProtocolModel!', false, $e);
         return false;
     }
     $tmpl->assign('protocol', $item);
     return parent::showEdit($id, $guid);
 }
示例#5
0
 public function showEdit($id, $guid)
 {
     global $tmpl;
     try {
         $item = new \MasterShaper\Models\PipeModel(array('idx' => $id, 'guid' => $guid));
     } catch (\Exception $e) {
         static::raiseError(__METHOD__ . '(), failed to load PipeModel!', false, $e);
         return false;
     }
     $tmpl->registerPlugin("function", "unused_filters_select_list", array(&$this, "smartyUnusedFiltersSelectList"), false);
     $tmpl->registerPlugin("function", "used_filters_select_list", array(&$this, "smartyUsedFiltersSelectList"), false);
     $tmpl->assign('pipe', $item);
     return parent::showEdit($id, $guid);
 }
示例#6
0
 public function showEdit($id, $guid)
 {
     global $tmpl;
     $tmpl->registerPlugin("function", "target_group_select_list", array(&$this, "smartyTargetGroupSelectLists"), false);
     try {
         $item = new \MasterShaper\Models\ChainModel(array('idx' => $id, 'guid' => $guid));
     } catch (\Exception $e) {
         static::raiseError(__METHOD__ . '(), failed to load ChainModel!', false, $e);
         return false;
     }
     $tmpl->registerPlugin("block", "pipe_list", array(&$this, "smartyPipeList"), false);
     $tmpl->assign('chain', $item);
     return parent::showEdit($id, $guid);
 }
示例#7
0
 public function __construct()
 {
     try {
         $keywords = new \Mtlda\Models\KeywordsModel();
     } catch (\Exception $e) {
         static::raiseError(__CLASS_ . ', failed to load KeywordsModel', true);
         return;
     }
     if (!$this->setViewData($keywords)) {
         static::raiseError(__CLASS__ . '::setViewData() returned false!', true);
         return;
     }
     parent::__construct();
     return;
 }
示例#8
0
 /**
  * overwrite parents __construct() method as we do not have a lot to do here.
  *
  * @param none
  * @return void
  * @throws \Thallium\Controllers\ExceptionController
  */
 public function __construct()
 {
     if (!\Thallium\Controllers\MainController::inTestMode()) {
         static::raiseError(__METHOD__ . '(), this view is only valid in test mode!', true);
         return;
     }
     if (!$this->addMode('show')) {
         static::raiseError(__CLASS__ . '::addMode() returned false!', true);
         return;
     }
     if (!$this->addContent('testcontent')) {
         static::raiseError(__CLASS__ . '::addContent() returned false!', true);
         return;
     }
     parent::__construct();
     return;
 }
示例#9
0
 /**
  * list all tasks
  */
 public function showList()
 {
     global $ms, $db, $tmpl;
     $this->avail_tasks = array();
     $this->tasks = array();
     if (isset($_GET['clear']) && $_GET['clear'] == 'finished') {
         $this->clearFinishedTask();
     }
     $res_tasks = $db->query("\n                SELECT\n                *\n                FROM\n                TABLEPREFIXtasks\n                WHERE\n                task_host_idx LIKE '" . $ms->get_current_host_profile() . "'\n                ORDER BY\n                task_submit_time DESC\n                ");
     $cnt_tasks = 0;
     while ($task = $res_tasks->fetch()) {
         $this->avail_tasks[$cnt_tasks] = $task->task_idx;
         $this->tasks[$task->task_idx] = $task;
         $cnt_tasks++;
     }
     return parent::showList();
 }
示例#10
0
 public function showEdit($id, $guid)
 {
     global $tmpl;
     try {
         $item = new \MasterShaper\Models\TargetModel(array('idx' => $id, 'guid' => $guid));
     } catch (\Exception $e) {
         static::raiseError(__METHOD__ . '(), failed to load TargetModel!', false, $e);
         return false;
     }
     $tmpl->registerPlugin("block", "target_group_select_list", array(&$this, "smartyTargetGroupSelectLists"), false);
     $tmpl->assign('target', $item);
     if (($this->targets_avail = $this->getTargets('avail', $item->getIdx())) === false) {
         static::raiseError(__CLASS__ . '::getTargets() returned false!');
         return false;
     }
     if (($this->targets_used = $this->getTargets('used', $item->getIdx())) === false) {
         static::raiseError(__CLASS__ . '::getTargets() returned false!');
         return false;
     }
     return parent::showEdit($id, $guid);
 }
示例#11
0
 public function showEdit($id, $guid)
 {
     global $tmpl;
     try {
         $item = new \MasterShaper\Models\FilterModel(array('idx' => $id, 'guid' => $guid));
     } catch (\Exception $e) {
         static::raiseError(__METHOD__ . '(), failed to load FilterModel!', false, $e);
         return false;
     }
     $tmpl->registerPlugin("function", "protocol_select_list", array(&$this, "smartyProtocolSelectList"), false);
     $tmpl->registerPlugin("function", "port_select_list", array(&$this, "smartyPortSelectList"), false);
     if (!$this->loadProtocols()) {
         static::raiseError(__CLASS__ . '::loadProtocols() returned false!');
         return false;
     }
     if (!$this->loadPorts()) {
         static::raiseError(__CLASS__ . '::loadPorts() returned false!');
         return false;
     }
     $tmpl->assign('filter', $item);
     return parent::showEdit($id, $guid);
 }
示例#12
0
文件: QueueView.php 项目: unki/mtlda
 public function __construct()
 {
     try {
         $queue = new \Mtlda\Models\QueueModel();
     } catch (\Exception $e) {
         static::raiseError(__METHOD__ . '(), failed to load QueueModel!', true);
         return false;
     }
     if (!$this->setViewData($queue)) {
         static::raiseError(__CLASS__ . '::setViewData() returned false!', true);
         return;
     }
     try {
         $this->import = new \Mtlda\Controllers\ImportController();
     } catch (\Exception $e) {
         static::raiseError(__METHOD__ . '(), failed to load ImportController!', true);
         return false;
     }
     if (!$this->addMode('archive')) {
         static::raiseError(__CLASS__ . '::addMode() returned false!', true);
         return false;
     }
     if (!$this->addMode('split')) {
         static::raiseError(__CLASS__ . '::addMode() returned false!', true);
         return false;
     }
     if (!$this->addContent('archiver')) {
         static::raiseError(__CLASS__ . '::addContent() returned false!', true);
         return false;
     }
     if (!$this->addContent('splitter')) {
         static::raiseError(__CLASS__ . '::addContent() returned false!', true);
         return false;
     }
     parent::__construct();
 }
示例#13
0
文件: apple.php 项目: naisly/WodenS
<?php

/**
 * Created by PhpStorm.
 * User: Home
 * Date: 22.11.2015
 * Time: 1:04
 */
include_once '..\\..\\Controllers\\DefaultController.php';
include_once '..\\..\\Model\\DefaultModel.php';
include_once '..\\..\\View\\DefaultView.php';
$model = new DefaultModel();
//It is important that the controller and the view share the model
$controller = new DefaultController($model);
$view = new DefaultView($model);
$controller->actionGetData('Apple', 'Gadgets', 'Apple');
$view->DoctypeView('Buy Ipad');
$view->headerView('apple-gadgets');
$view->GetUI('device', 'gadgets');
示例#14
0
文件: index.php 项目: naisly/WodenS
<?php

/**
 * Created by PhpStorm.
 * User: Home
 * Date: 22.11.2015
 * Time: 0:12
 */
include_once '..\\..\\Controllers\\DefaultController.php';
include_once '..\\..\\Model\\DefaultModel.php';
include_once '..\\..\\View\\DefaultView.php';
//initiate the triad
$model = new DefaultModel();
//It is important that the controller and the view share the model
$controller = new DefaultController($model);
$view = new DefaultView($model);
$controller->actionGetData('Gadgets', 'Gadgets', 'All');
$view->DoctypeView('Buy Device');
$view->headerView('gadgets');
$view->GetUI('device', 'gadgets');
示例#15
0
 function execute(&$filterChain, &$controller, &$request, &$user)
 {
     $execChain =& $controller->getExecutionChain();
     $action =& $execChain->getAction($execChain->getSize() - 1);
     $actName = $controller->getCurrentAction();
     $modName = $controller->getCurrentModule();
     $method = $request->getMethod();
     if ($action->initialize($controller, $request, $user)) {
         if ($action->isSecure()) {
             $authHandler =& $controller->getAuthorizationHandler();
             if ($authHandler === NULL) {
                 trigger_error('Action requires security but no authorization ' . 'handler has been registered', E_USER_NOTICE);
             } else {
                 if (!$authHandler->execute($controller, $request, $user, $action)) {
                     return;
                 }
             }
         }
         if (($action->getRequestMethods() & $method) != $method) {
             $actView = $action->getDefaultView($controller, $request, $user);
         } else {
             $validManager =& new ValidatorManager();
             $action->registerValidators($validManager, $controller, $request, $user);
             if (!$validManager->execute($controller, $request, $user) || !$action->validate($controller, $request, $user)) {
                 $actView = $action->handleError($controller, $request, $user);
             } else {
                 $actView = $action->execute($controller, $request, $user);
             }
         }
         if (is_string($actView) || $actView === NULL) {
             $viewMod = $modName;
             $viewAct = $actName;
             $viewName = $actView;
         } else {
             if (is_array($actView)) {
                 $viewMod = $actView[0];
                 $viewAct = $actView[1];
                 $viewName = $actView[2];
             }
         }
         if ($viewName != VIEW_NONE) {
             /*
                             if (!$controller->viewExists($viewMod, $viewAct, $viewName))
                             {
             
                                 $error = 'Module ' . $viewMod . ' does not contain view ' .
                                          $viewAct . 'View_' . $viewName . ' or the file is ' .
                                          'not readable';
                                 trigger_error($error, E_USER_ERROR);
                                 exit;
                             }
             */
             if (!$controller->viewExists($viewMod, $viewAct, $viewName)) {
                 $view = new DefaultView();
             } else {
                 $view =& $controller->getView($viewMod, $viewAct, $viewName);
             }
             $layout = $action->layout;
             if ($layout) {
                 $test = $view->initialize($controller, $request, $user);
                 $renderer =& $view->execute($controller, $request, $user);
                 $renderer->setMode(RENDER_VAR);
                 $partial = $renderer->fetchResult($controller, $request, $user);
                 $layout_renderer =& RendererUtils::getSmartyRenderer();
                 $layout_template = "{$layout}.html";
                 $layout_renderer->setTemplate($layout_template);
                 $layout_renderer->setAttribute('partial', $partial);
                 $layout_renderer->execute($controller, $request, $user);
             } else {
                 $test = $view->initialize($controller, $request, $user);
                 $renderer =& $view->execute($controller, $request, $user);
                 $renderer->execute($controller, $request, $user);
             }
             $view->cleanup($controller, $request, $user);
             $request->setAttributeByRef('org.mojavi.renderer', $renderer);
         }
     }
 }
示例#16
0
文件: index.php 项目: naisly/WodenS
<?php

/**
 * Created by PhpStorm.
 * User: Home
 * Date: 17.11.2015
 * Time: 22:40
 */
include_once '..\\..\\Controllers\\DefaultController.php';
include_once '..\\..\\Model\\DefaultModel.php';
include_once '..\\..\\View\\DefaultView.php';
//initiate the triad
$model = new DefaultModel();
//It is important that the controller and the view share the model
$controller = new DefaultController($model);
$view = new DefaultView($model);
$controller->actionGetData('Notebooks', 'Notebooks', 'All');
$view->DoctypeView('Buy Laptop');
$view->headerView('notebooks');
$view->GetUI('laptop', 'notebooks');
示例#17
0
 public function __construct(ProfileModel $model)
 {
     parent::__construct($model);
     $this->model = $model;
 }
示例#18
0
文件: apple.php 项目: naisly/WodenS
<?php

/**
 * Created by PhpStorm.
 * User: Home
 * Date: 20.11.2015
 * Time: 18:25
 */
include_once '..\\..\\Controllers\\DefaultController.php';
include_once '..\\..\\Model\\DefaultModel.php';
include_once '..\\..\\View\\DefaultView.php';
//initiate the triad
$model = new DefaultModel();
//It is important that the controller and the view share the model
$controller = new DefaultController($model);
$view = new DefaultView($model);
$controller->actionGetData('Apple', 'Notebooks', 'Apple');
$view->DoctypeView('Buy Macbook');
$view->headerView('apple-notebooks');
$view->GetUI('laptop', 'notebooks');
示例#19
0
文件: index.php 项目: naisly/WodenS
<?php

/**
 * Created by PhpStorm.
 * User: Home
 * Date: 28.10.2015
 * Time: 18:57
 */
include_once '..\\..\\Controllers\\DefaultController.php';
include_once '..\\..\\Model\\DefaultModel.php';
include_once '..\\..\\View\\DefaultView.php';
//initiate the triad
$model = new DefaultModel();
//It is important that the controller and the view share the model
$controller = new DefaultController($model);
$view = new DefaultView($model);
$controller->actionGetData('Phones', 'Phones', 'All');
$view->DoctypeView('Buy Phone');
$view->headerView('phones');
$view->GetUI('phone', 'phones');
示例#20
0
 public function __construct(LoginModel $model)
 {
     parent::__construct($model);
     $this->model = $model;
 }
示例#21
0
 public function __construct(SubdescriptionModel $model)
 {
     parent::__construct($model);
     $this->model = $model;
 }
示例#22
0
文件: samsung.php 项目: naisly/WodenS
<?php

/**
 * Created by PhpStorm.
 * User: Home
 * Date: 03.11.2015
 * Time: 23:15
 */
include_once '..\\..\\Controllers\\DefaultController.php';
include_once '..\\..\\Model\\DefaultModel.php';
include_once '..\\..\\View\\DefaultView.php';
//initiate the triad
$model = new DefaultModel();
//It is important that the controller and the view share the model
$controller = new DefaultController($model);
$view = new DefaultView($model);
$controller->actionGetData('Samsung', 'Phones', 'Samsung');
$view->DoctypeView('Buy Samsung Phone');
$view->headerView('Samsung-phones');
$view->GetUI('phone', 'phones');
示例#23
0
文件: apple.php 项目: naisly/WodenS
<?php

/**
 * Created by PhpStorm.
 * User: Home
 * Date: 29.10.2015
 * Time: 8:51
 */
include_once '..\\..\\Controllers\\DefaultController.php';
include_once '..\\..\\Model\\DefaultModel.php';
include_once '..\\..\\View\\DefaultView.php';
//initiate the triad
$model = new DefaultModel();
//It is important that the controller and the view share the model
$controller = new DefaultController($model);
$view = new DefaultView($model);
$controller->actionGetData('Apple', 'Phones', 'Apple');
$view->DoctypeView('Buy Iphone');
$view->headerView('apple-phones');
$view->GetUI('phone', 'phones');
示例#24
0
 public function dataList($params, $content, &$smarty, &$repeat)
 {
     try {
         $content = parent::dataList($params, $content, $smarty, $repeat);
     } catch (\Exception $e) {
         static::raiseError(__CLASS__ . '::dataList() returned false!', false, $e);
         $repeat = false;
         return false;
     }
     if (!$this->hasCurrentItem()) {
         return $content;
     }
     if (($item = $this->getCurrentItem()) === false) {
         static::raiseError(__CLASS__ . '::getCurrentItem() returned false!');
         $repeat = false;
         return false;
     }
     if ($item->hasDescendants()) {
         if (($latest = $item->getLastestVersion()) === false) {
             static::raiseError(get_class($item) . '::getLastestVersion() returned false!');
             $repeat = false;
             return false;
         }
         if (!($idx = $latest->getIdx())) {
             static::raiseError(get_class($latest) . '::getIdx() returned false!');
             $repeat = false;
             return false;
         }
         if (!($guid = $latest->getGuid())) {
             static::raiseError(get_class($latest) . '::getGuid() returned false!');
             $repeat = false;
             return false;
         }
         $smarty->assign("document_safe_link", "document-{$idx}-{$guid}");
         unset($latest);
     } else {
         $smarty->assign("document_safe_link", "document-{$item->getIdx()}-{$item->getGuid()}");
     }
     return $content;
 }
示例#25
0
 public function show()
 {
     global $ms, $session, $tmpl;
     /* If authentication is enabled, check permissions */
     if ($ms->getOption("authentication") == "Y" && !$ms->checkPermissions("user_show_rules")) {
         static::raiseError("You do not have enough permissions to access this module!");
         return false;
     }
     if (($host_id = $session->getCurrentHostProfile()) === false) {
         static::raiseError('Do not know for which host I am working for!');
         return false;
     }
     try {
         $nps = new \MasterShaper\Models\NetworkPathsModel(array('host_idx' => $host_id, 'active' => 'Y'));
     } catch (\Exception $e) {
         static::raiseError(__METHOD__ . '(), failed to load NetworkPathsModel!', false, $e);
         return false;
     }
     if (!$nps->hasItems()) {
         return parent::show();
     }
     $tmpl->assign('nps', $nps);
     return parent::show();
     if (($network_paths = $nps->getItems()) === false) {
         static::raiseError(get_class($nps) . '::getItems() returned false!');
         return false;
     }
     foreach ($network_paths as $np) {
         $id = array_push($this->rules, $np);
         if (($netpath_idx = $np->getIdx()) === false) {
             static::raiseError(get_class($np) . '::getIdx() returned false!');
             return false;
         }
         if (($chains = $np->getActiveChains()) === false) {
             static::raiseError(get_class($np) . '::getActiveChains() returned false!');
             return false;
         }
         foreach ($chains as $chain) {
             if (($chain_idx = $chain->getIdx()) === false) {
                 static::raiseError(get_class($chain) . '::getIdx() returned false!');
                 return false;
             }
             if (($pipes = $chain->getActivePipes()) === false) {
                 static::raiseError(get_class($chain) . '::getActivePipes() returned false!');
                 return false;
             }
             foreach ($pipes as $pipe) {
                 array_push($this->pipes[$chain_idx], $pipe);
                 if (($pipe_idx = $pipe->getIdx()) === false) {
                     static::raiseError(get_class($pipe) . '::getIdx() returned false!');
                     return false;
                 }
                 if (!isset($this->filters[$pipe_idx]) || !is_array($this->filters[$pipe_idx])) {
                     $this->filters[$pipe_idx] = array();
                 }
                 if (($filters = $pipe->getActiveFilters()) === false) {
                     static::raiseError(get_class($pipe) . '::getActiveFilters() returned false!');
                     return false;
                 }
                 foreach ($filters as $filter) {
                     array_push($this->filters[$pipe_idx], $filter);
                 }
             }
         }
     }
     if (!$tmpl->registerPlugin("block", "ov_netpath", array(&$this, "smartyOverviewNetpath"))) {
         static::raiseError(get_class($tmpl) . '::registerPlugin() returned false!');
         return false;
     }
     if (!$tmpl->registerPlugin("block", "ov_chain", array(&$this, "smartyOverviewChain"))) {
         static::raiseError(get_class($tmpl) . '::registerPlugin() returned false!');
         return false;
     }
     if (!$tmpl->registerPlugin("block", "ov_pipe", array(&$this, "smartyOverviewPipe"))) {
         static::raiseError(get_class($tmpl) . '::registerPlugin() returned false!');
         return false;
     }
     if (!$tmpl->registerPlugin("block", "ov_filter", array(&$this, "smartyOverviewFilter"))) {
         static::raiseError(get_class($tmpl) . '::registerPlugin() returned false!');
         return false;
     }
     return parent::show();
 }
示例#26
0
文件: samsung.php 项目: naisly/WodenS
<?php

/**
 * Created by PhpStorm.
 * User: Home
 * Date: 22.11.2015
 * Time: 1:04
 */
include_once '..\\..\\Controllers\\DefaultController.php';
include_once '..\\..\\Model\\DefaultModel.php';
include_once '..\\..\\View\\DefaultView.php';
//initiate the triad
$model = new DefaultModel();
//It is important that the controller and the view share the model
$controller = new DefaultController($model);
$view = new DefaultView($model);
$controller->actionGetData('Samsung', 'Gadgets', 'Samsung');
$view->DoctypeView('Buy Galaxy Tab');
$view->headerView('samsung-gadgets');
$view->GetUI('device', 'gadgets');
示例#27
0
 public function __construct(SupportModel $model)
 {
     parent::__construct($model);
     $this->model = $model;
 }
示例#28
0
 public function __construct(CheckOrderModel $model)
 {
     parent::__construct($model);
     $this->model = $model;
 }
示例#29
0
 public function __construct(DefaultModel $model)
 {
     parent::__construct($model);
     $this->model = $model;
 }
示例#30
0
 public function showEdit($id, $guid)
 {
     global $tmpl;
     try {
         $item = new \MasterShaper\Models\NetworkPathModel(array('idx' => $id, 'guid' => $guid));
     } catch (\Exception $e) {
         static::raiseError(__METHOD__ . '(), failed to load NetworkPathModel!', false, $e);
         return false;
     }
     try {
         $chains = new \MasterShaper\Models\ChainsModel(array('host_idx' => $id));
     } catch (\Exception $e) {
         static::raiseError(__METHOD__ . '(), failed to load ChainsModel!', false, $e);
         return false;
     }
     if (($this->chains = $chains->getItems()) === false) {
         static::raiseError(get_class($chains) . '::getItems() returned false!');
         return false;
     }
     $tmpl->assign('netpath', $item);
     return parent::showEdit($id, $guid);
 }