本文整理汇总了PHP中ui::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP ui::assign方法的具体用法?PHP ui::assign怎么用?PHP ui::assign使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ui
的用法示例。
在下文中一共展示了ui::assign方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index($parameters)
{
$pageModel = new pageModel();
$view = new ui($this);
$view->assign('pages', $allowedPages);
$startlevel = isset($parameters['startlevel']) ? $parameters['startlevel'] : 1;
$id = myauth::getCurrentpageid();
$page = $pageModel->getfromId($id);
$page = $page[0];
$tree[] = $page;
while ($page->getParentid() != 0) {
$page = $pageModel->getfromId($page->getParentid());
$page = $page[0];
$tree[] = $page;
$this->tree_id[$page->getId()] = $page->getId();
}
$this->tree = array_reverse($tree);
if ($startlevel != 1) {
$startbelow = $this->tree[$startlevel - 2]->getId();
} else {
$startbelow = 0;
}
$this->maxdepth = isset($parameters['maxdepth']) ? $parameters['maxdepth'] : -1;
$depth = 1;
$pages = $this->recursivegetpages($startbelow, $depth);
$view->assign('menu', $pages);
$this->response->assign($this->self, 'innerHTML', $view->fetch($parameters['viewprefix'] . 'menu_index.tpl'));
}
示例2: updatesuggestselectfield
public function updatesuggestselectfield($parameters = array())
{
$result = array();
$view = new ui($this);
if ($parameters['value'] != '') {
$controller = $parameters['callbackcontroller'] . 'Controller';
$function = $parameters['callbackfunction'];
$extra = $parameters['extraparams'];
$extralist = explode(',', $extra);
$extraparams = array();
foreach ($extralist as $extraparam) {
list($key, $value) = explode('|', $extraparam);
$extraparams[$key] = $value;
}
$theController = new $controller();
$result = $theController->{$function}(rawurldecode($parameters['value']), $extraparams);
$form = new form($parameters);
list($id, $name) = explode('_', $parameters['id'], 2);
$form->setId($id);
$select = new selectField(str_replace('_text', '', $name), '', '', true);
$form->addField($select);
foreach ($result as $row) {
$select->addOption(new selectoptionField($row, $row, false));
}
$view->assign('form', $form);
$view->assign('field', $select);
$this->response->assign(str_replace('_text', '', $parameters['id']) . '_container', 'innerHTML', $view->fetch('selectField.tpl'));
} else {
$form = new form($parameters);
$select = new selectField($parameters['id'], '', '', true);
$view->assign('form', $form);
$view->assign('field', $select);
$this->response->assign(str_replace('_text', '', $parameters['id']) . '_container', 'innerHTML', $view->fetch('selectField.tpl'));
}
}
示例3: createErrorView
function createErrorView($exception)
{
$ui = new ui();
$ui->assign('exceptionid', uniqid());
$ui->assign('exception', $exception);
$template = VERBOSE_ERRORS ? 'detailederror.tpl' : 'shorterror.tpl';
return $ui->fetch($template);
}
示例4: confirm
protected function confirm($controller, $title = '')
{
$view = new ui($controller);
$view->assign('form', $this);
$view->assign('title', $title);
//$popup = new popupController();
//$popup->create(array('name' => 'confirm','title' => $title, 'content' => $view->fetch('confirmform.tpl')));
$response = responseLib::getInstance();
$response->assign($controller->getSelf(), 'innerHTML', $view->fetch('confirmform.tpl'));
}
示例5: loginform
public function loginform($parameters = array())
{
require FRAMEWORK . DS . 'conf' . DS . 'auth.php';
require FRAMEWORK . DS . 'conf' . DS . 'dispatcher.php';
$currentuser = myauth::getCurrentuser();
$groups = $currentuser->getGroupid();
$groupfound = false;
foreach ($groups as $groupname => $groupid) {
if (isset($defaultPageids[$groupname])) {
$groupfound = true;
$defaultPageid = $defaultPageids[$groupname];
}
}
if (!$groupfound) {
$defaultPageid = $defaultPageids['default'];
}
if ($currentuser->getId() == $defaultUserid) {
$form = new form($parameters);
$username = new textField('username', 'Gebruiker', '', array('required'));
$password = new passwordField('password', 'Wachtwoord', array('required'));
$form->addField($username);
$form->addField($password);
$form->setSubmittext('Log in');
$form->setResettext('Herbegin');
$template = new ui($this);
if ($form->validate()) {
$usermodel = new userModel();
$authuser = $usermodel->auth($parameters['username'], $parameters['password']);
if ($authuser instanceof userObject) {
myauth::setCurrentuser($authuser);
// Refresh the page
$this->response->redirect('?pageid=' . $defaultPageid);
} else {
$this->response->assign('formerror_' . $form->getId(), 'innerHTML', 'De ingevulde gegevens zijn niet correct.', true);
}
} elseif (!$form->isSent()) {
$template->assign('form', $form);
$this->response->assign($this->self, 'innerHTML', $template->fetch($parameters['viewprefix'] . 'myauth_loginform.tpl'));
} else {
$this->response->assign('formerror_' . $form->getId(), 'innerHTML', 'Alle velden moeten ingevuld worden.', true);
}
} else {
$template = new ui($this);
$defrequest = new pagerequest($defaultPageid);
$template->assign('defrequest', $defrequest);
$template->assign('logoutRequest', myauth::getLogoutrequest());
$template->assign('currentuser', $currentuser);
$this->response->assign($this->self, 'innerHTML', $template->fetch($parameters['viewprefix'] . 'myauth_loginform_loggedin.tpl'));
//$this->response->assign($this->self , 'innerHTML' , '');
}
}
示例6: createflash
public function createflash($parameters)
{
$name = $parameters['name'] . uniqid();
$content = $parameters['content'];
if (isset($parameters['duration'])) {
$duration = $parameters['duration'];
} elseif ($parameters['type'] == 'success') {
$duration = 5000;
} elseif ($parameters['type'] == 'warning') {
$duration = 8000;
} elseif ($parameters['type'] == 'error') {
$duration = -1;
}
$destroyRequest = new ajaxrequest('popup', 'destroy', array('name' => $name));
$template = new ui($this);
$template->assign('name', $name);
$template->assign('content', $content);
$template->assign('destroyRequest', $destroyRequest);
$template->assign('type', $parameters['type']);
$this->response->assign('flashcontainer', 'innerHTML', $template->fetch('flash.tpl'));
if ($duration != -1) {
$this->response->script("setTimeout(\"\$('{$name}').fade('out')\",{$duration});setTimeout(\"\$('{$name}').dispose()\"," . ($duration + 300) . ");");
}
}
示例7: showallowed
public function showallowed($parameter = array())
{
$view = new ui($this);
$grid = new mygrid('allowed');
$grid->setModel(new ftgdallowedModel());
$grid->setDefaultorder(array('fields' => array('time'), 'type' => 'DESC'));
$grid->setPagesize(15);
$grid->registerRequest('user', 'mygrid', 'search', array('directsearch' => 'true', 'gridid' => $grid->getId(), 'search' => '{user}'));
$grid->registerRequest('group', 'mygrid', 'search', array('directsearch' => 'true', 'gridid' => $grid->getId(), 'search' => '{group}'));
$grid->registerRequest('sourceip', 'mygrid', 'search', array('directsearch' => 'true', 'gridid' => $grid->getId(), 'search' => '{sourceip}'));
$grid->registerRequest('host', 'mygrid', 'search', array('directsearch' => 'true', 'gridid' => $grid->getId(), 'search' => '{host}'));
$grid->registerRequest('cat', 'mygrid', 'search', array('directsearch' => 'true', 'gridid' => $grid->getId(), 'search' => '{cat}'));
$grid->registerRequest('destip', 'mygrid', 'search', array('directsearch' => 'true', 'gridid' => $grid->getId(), 'search' => '{destip}'));
$view->assign('blocked', $grid);
$this->response->assign($this->self, 'innerHTML', $view->fetch('ftgd_allowed.tpl'));
}
示例8: adddokter
public function adddokter($parameters = array())
{
require FRAMEWORK . DS . 'conf' . DS . 'mydhcpcc.php';
$view = new ui($this);
$form = new form($parameters);
$form->addField(new textField('mac', 'Mac', '', array('required', 'mac')));
$form->addField(new textField('desc', 'Omschrijving', '', array('required')));
if ($form->validate()) {
$output = array();
$lastline = exec('c:' . DS . 'plink.exe ' . $siecarehost . ' -l ' . $siecareuser . ' -i ' . $siecareppk . ' sudo /usr/sbin/adddokter ' . $form->getFieldvalue('mac') . ' ' . $form->getFieldvalue('desc') . ' && exit', $output);
if ($lastline == 'Starting dhcpd: [ OK ]') {
$form->clear();
}
$output = implode('<br />', $output);
$this->response->assign('formerror_' . $form->getId(), 'innerHTML', $output, true);
} elseif (!$form->isSent()) {
$view->assign('form', $form);
$this->response->assign($this->self, 'innerHTML', $view->fetch('mydhcpcc_adddokter.tpl'));
}
}
示例9: validate
function validate($value, $form = null)
{
$this->form = $form;
$valid = true;
foreach ($this->validator as $req) {
list($function, $param) = explode(':', $req, 2);
$function = 'validate_' . $function;
if (!call_user_func(array($this, $function), $param, $value)) {
$valid = false;
}
}
$response = responseLib::getInstance();
if (!$valid) {
$template = new ui($this);
$template->assign('validateerror', $this->validateerror);
//$response->assign($this->id . '_error' , 'innerHTML' , $template->fetch('validateerror.tpl'),true);
$response->assign($this->id, 'title', $template->fetch('validateerror.tpl'));
$response->script("highlightformfielderror('{$this->id}')");
} else {
$response->assign($this->id, 'title', '');
$response->script("removehighlightformfielderror('{$this->id}')");
}
return $valid;
}
示例10: run
public function run()
{
require FRAMEWORK . DS . 'conf' . DS . 'dispatcher.php';
require FRAMEWORK . DS . 'conf' . DS . 'auth.php';
$pageid = isset($_GET['pageid']) ? $_GET['pageid'] : $defaultPageid;
$page = $this->resolvePage($pageid);
$pageid = $page->getId();
$module_pageModel = new modulepageModel();
// -1 equals all pages
$req = array();
$req['pageid'] = array('mode' => 'IN', 'value' => array('-1', $pageid));
$order = array('fields' => array('areaid', 'order'), 'type' => 'ASC');
try {
$modulesForPage = $module_pageModel->get($req, $order);
} catch (Exception $e) {
//error
echo $e->getMessage();
}
$pageview = new ui();
$xajaxJs = $this->xajax->getJavascript();
global $debugajax;
if ($debugajax) {
$debugJs = '<script type="text/javascript" src="xajax_js/xajax_debug.js" charset="UTF-8"></script>';
$pageview->assign('xajax_javascript', $xajaxJs . "\n" . $debugJs);
} else {
$pageview->assign('xajax_javascript', $xajaxJs);
}
$output = array();
$moduleModel = new moduleModel();
foreach ($modulesForPage as $moduleForPage) {
try {
$areaModel = new areaModel();
$area = $areaModel->getfromId($moduleForPage->getAreaid());
$meh = 1;
if (count($area) == 1) {
$area = $area[0];
} else {
throw new Exception('Area could not be loaded');
}
$module = $moduleModel->getfromId($moduleForPage->getModuleid());
if (count($module) == 1) {
$module = $module[0];
} else {
throw new Exception('Module could not be loaded');
}
$controllerName = $module->getName() . 'Controller';
$actionName = $module->getAction();
$controller = new $controllerName($module->getPrefix() . '_' . $module->getName());
foreach ($controller->getAllowedget() as $allowedGetVar) {
if (isset($_GET[$allowedGetVar])) {
$module->addArguments(array($allowedGetVar => $_GET[$allowedGetVar]));
}
}
$output[$area->getName()] .= '<div id="' . $module->getPrefix() . '_' . $module->getName() . '" class="module">' . $controller->{$actionName}($module->getArguments()) . '</div>';
} catch (Exception $e) {
// Ok, that didn't work
$result = createErrorView($e);
if ($area instanceof areaObject) {
$output[$area->getName()] .= '<div class="module">' . $result . '</div>';
}
}
}
// Add the popup div
$output['popup'] = '<div id="popupcontainer" style="visibility: hidden; position: absolute;"></div>';
foreach ($output as $area => $content) {
$pageview->assign($area, $content);
}
// Add the RTE
$myrte = new myrte();
$pageview->assign('rteheader', $myrte->getHeader());
$pageview->display($page->getTemplate());
// Init the responses
$response = responseLib::getInstance();
$_SESSION['initpageresponse'] = $response;
//echo '<script type="text/javascript" charset="UTF-8">xajax_initpage();</script>';
}
示例11: editMessage
public function editMessage($parameters = array())
{
$view = new ui($this);
require FRAMEWORK . DS . 'conf' . DS . 'medibridgeparser.php';
$view->assign('basesourcemap', $basesourcemap);
$view->assign('backupmap', $backupmap);
$view->assign('errormap', $errormap);
$view->assign('basedestinationmap', $basedestinationmap);
$closerequest = new ajaxrequest('medibridgeparser', 'closeLog');
$view->assign('closerequest', $closerequest);
$pmodel = new mbprocessedlogModel();
$model = new mblogModel();
$log = $model->getfromId($parameters['logid']);
$plog = $pmodel->getfromId($parameters['logid']);
if (count($log) == 1) {
$log = $log[0];
}
if (count($plog) == 1) {
$plog = $plog[0];
}
$view->assign('log', $log);
$view->assign('plog', $plog);
$location = '';
if ($log->getStatusdelivery() == 'DELIVERY_SUCCESS' && $log->getStatusbackup() == 'BACKUP_SUCCES') {
$location = $backupmap . '\\' . $log->getRelativebackuppath();
} elseif ($log->getStatusdelivery() == 'MESSAGE_RESEND' && $log->getStatusbackup() == 'BACKUP_SUCCES') {
$location = $backupmap . '\\' . $log->getRelativebackuppath();
} elseif ($log->getStatuserror() == 'ERROR_MOVE_SUCCESS') {
$location = $errormap . '\\' . $log->getRelativeerrorpath();
} else {
$location = 'GEEN BESTAND GEVONDEN!';
}
$destination = $basesourcemap . '\\' . $log->getRelativesourcepath();
$view->assign('sourcelocation', $location);
$view->assign('destination', $destination);
$file = utf8_encode(file_get_contents($location));
$form = new form($parameters);
$form->addField(new hiddenField('logid', $parameters['logid']));
$doktermodel = new mbdokterModel();
$dokters = $doktermodel->get(array(), array('fields' => array('achternaam'), 'mode' => 'ASC'));
$select = new selectField('ontvanger', 'Verzet ontvanger naar');
$select->addOption(new selectoptionField('Niet verzetten', 'none'));
foreach ($dokters as $dokter) {
$select->addOption(new selectoptionField($dokter->getAchternaam() . ' ' . $dokter->getVoornaam() . ' - ' . $dokter->getRiziv(), $dokter->getRiziv()));
}
$form->addField($select);
$form->addField(new textareaField('content', 'Bericht', $file, array('required')));
$view->assign('form', $form);
$ignorerequest = new ajaxrequest('medibridgeparser', 'ignorelog', array('logid' => $parameters['logid']));
$view->assign('ignore', $ignorerequest);
if ($form->validate()) {
try {
file_put_contents($location, $form->getFieldvalue('content'));
$arrcontent = file($location, FILE_IGNORE_NEW_LINES);
if ($form->getFieldvalue('ontvanger') != 'none') {
if (stripos($location, 'hdm-lab') !== false) {
$i = 0;
foreach ($arrcontent as $fileline) {
if (stripos($fileline, 'A4') === 0) {
$parts = explode('\\', $fileline);
$parts[2] = $form->getFieldvalue('ontvanger');
$fileline = implode('\\', $parts);
$arrcontent[$i] = rtrim($fileline);
break;
} else {
$arrcontent[$i] = rtrim($fileline);
}
$i++;
}
} else {
$arrcontent[7] = $form->getFieldvalue('ontvanger');
}
}
$i = 0;
foreach ($arrcontent as $fileline) {
$arrcontent[$i] = rtrim($fileline);
$i++;
}
file_put_contents($location, implode("\r\n", $arrcontent));
if (!rename($location, $destination)) {
throw new Exception('Could not move file.');
}
$log->setStatusdelivery('MESSAGE_RESEND');
$model->save($log);
$this->response->redirect('?pageid=' . myauth::getCurrentpageid());
} catch (Exception $e) {
$this->response->assign('formerror_' . $form->getId(), 'innerHTML', 'Er was een probleem met het verwerken van de aanpassingen! (' . $e->getMessage() . ')', true);
}
} elseif (!$form->isSent()) {
$this->response->assign('logcontainer', 'innerHTML', $view->fetch($parameters['viewprefix'] . 'medibridgeparser_editmessage.tpl'));
}
}
示例12: wikieditversion
public function wikieditversion($parameters = array())
{
$view = new ui($this);
$articlemodel = new myarticleModel();
$versionmodel = new myarticleversionModel();
$version = $versionmodel->getfromId($parameters['id']);
if (count($version) == 1) {
$version = $version[0];
$form = new mygridform($parameters, $parameters['-gridid-'], 'edit');
$form->addField(new textField('title', 'Titel', $version->getTitle(), array('required')));
$form->addField(new hiddenField('start', time()));
$form->addField(new hiddenField('alias', $parameters['alias']));
$form->addField(new hiddenField('limit', ''));
$form->addField(new hiddenField('stop', -1));
$form->addField(new hiddenField('section', $parameters['section']));
$form->addField(new rteField('content', 'Inhoud', $version->getContent(), array('required')));
$draft = new selectField('state', 'Bewaar als', array('required'));
$draft->addOption(new selectoptionField('Actieve versie', 'Actief', true));
$draft->addOption(new selectoptionField('Draft', 'Draft', false));
$form->addField($draft);
$form->addField(new hiddenField('articleid', $parameters['articleid']));
$form->addField(new hiddenField('id', $parameters['id']));
if ($form->validate()) {
$newversion = new myarticleversionObject();
$newversion->setArticleid($parameters['articleid']);
$newversion->setAuthor(myauth::getCurrentuser()->getId());
$newversion->setAuthorname(myauth::getCurrentuser()->getName());
$newversion->setCreationdate(time());
$newversion->setTitle($form->getFieldvalue('title'));
$newversion->setState($form->getFieldvalue('state'));
$newversion->setStartpublishdate($form->getFieldvalue('start'));
$newversion->setContent($form->getFieldvalue('content'));
if ($form->getFieldvalue('limit') == 'limit') {
$newversion->setStoppublishdate($form->getFieldvalue('stop'));
} else {
$newversion->setStoppublishdate(-1);
}
try {
if ($form->getFieldvalue('state') == 'Actief') {
$articleidcond = array('articleid' => array('mode' => '=', 'value' => $parameters['articleid']));
$statecond = array('state' => array('mode' => '=', 'value' => 'Actief'));
$prevactive = $versionmodel->get(array('AND' => array($articleidcond, $statecond)));
foreach ($prevactive as $prev) {
// This could have been if equal to 1 and just do the one, but this method is "self-healing" if multiple versions get flagged active
$prev->setState('Gearchiveerd');
$versionmodel->save($prev);
}
}
$versionmodel->save($newversion);
} catch (Exception $e) {
$flash = new popupController();
$flash->createflash(array('name' => 'erroredit', 'type' => 'error', 'content' => 'De gegevens werden niet aangepast! Raadpleeg de informaticadienst.'));
return false;
}
$flash = new popupController();
$flash->createflash(array('name' => 'flash_add_' . $parameters['-gridid-'], 'type' => 'success', 'content' => 'De gegevens zijn goed aangepast.'));
$this->response->assign('gridextra_' . $parameters['-gridid-'], 'innerHTML', '');
return true;
} elseif (!$form->isSent()) {
$view->assign('form', $form);
return $view->fetch('myarticle_editversion.tpl');
} else {
return false;
}
} else {
return false;
}
}
示例13: deletegast
public function deletegast($parameters)
{
$gastid = $parameters['gastid'];
$popupcontroller = new popupController();
$gastModel = new ingeschrevenModel();
$gast = $gastModel->getfromId($gastid);
if (count($gast) == 1) {
$gast = $gast[0];
} else {
return;
}
$sure = $parameters['sure'];
if ($sure != 'sure') {
$template = new ui($this);
$template->assign('gast', $gast);
$ja = new ajaxrequest('myvoorinschrijving', 'deletegast', array('gastid' => $gastid, 'sure' => 'sure'));
$template->assign('ja', $ja);
$popupcontroller->create(array('name' => 'confirm', 'content' => $template->fetch('myvoorinschrijving_confirmdelete.tpl')));
} elseif (myacl::isAllowed(myauth::getCurrentuser(), $gast, 'delete')) {
$popupcontroller->destroy(array('name' => 'confirm'));
$gastModel->deletebyId($gastid);
$this->response->remove($gastid . '_rij');
}
}
示例14: updateeditform
public function updateeditform($parameters = array())
{
$flash = new popupController();
$model = new moduleModel();
$modules = $model->getfromId($parameters['moduleid']);
if (count($modules) == 1) {
$module = $modules[0];
$parameters['themodule'] = $module;
$form = $this->buildeditform($parameters);
$view = new ui($this);
$view->assign('form', $form);
$this->response->assign('gridextra_' . $parameters['-gridid-'] . '_content', 'innerHTML', $view->fetch('mymoduleadmin_addmodule.tpl'));
} else {
$flash->createflash(array('name' => 'error', 'type' => 'error', 'content' => 'De module werd niet gevonden!'));
return false;
}
}
示例15: deletemodulepagelink
public function deletemodulepagelink($parameters = array())
{
if ($parameters['sure'] == 'sure') {
$model = new myarticlesectionlinkModel();
$flash = new popupController();
$curlink = $model->getfromId($parameters['id']);
if (count($curlink) == 1) {
try {
$model->deletebyId($parameters['id']);
} catch (Exception $e) {
$flash->createflash(array('name' => 'error', 'type' => 'error', 'content' => 'De aanpassing werd niet doorgevoerd! Contacteer de informaticadienst.'));
return false;
}
} else {
$flash->createflash(array('name' => 'warning', 'type' => 'warning', 'content' => 'De aanpassing werd niet doorgevoerd omdat deze link reeds verwijderd was!'));
return false;
}
$flash->createflash(array('name' => 'error', 'type' => 'success', 'content' => 'De aanpassing werd goed doorgevoerd.'));
return true;
} else {
$model = new processedmodulepageModel();
$link = $model->getfromId($parameters['id']);
if (count($link) == 1) {
$view = new ui($this);
$view->assign('link', $link[0]);
return $view->fetch('mypageadmin_deletemodulepagelink.tpl');
}
}
}