public function action_edit() { $id = $this->request->param('id'); $form = new Form('security/groups/edit' . ($id ? '/' . $id : '')); $form->add("name", 'Name', Form::STRING, '', array('not_empty'))->add('is_admin', 'Administrative group', Form::BOOL)->add('show_all_jobs', 'Show all jobs (unchecked - show only assigned jobs)', Form::BOOL)->add('allow_assign', 'Allow assigning jobs', Form::BOOL)->add('allow_reports', 'Allow tracking changes', Form::BOOL)->add('allow_submissions', 'Allow tracking submissions', Form::BOOL)->add('allow_finance', 'Financial reports', Form::BOOL)->add('allow_forms', 'Forms submission', Form::BOOL)->add('allow_custom_forms', 'Custom forms submission', Form::BOOL)->add('edit_custom_forms', 'Edit custom forms reports', Form::BOOL)->add('time_machine', 'Time Machine', Form::BOOL); $form->add('columns', 'Show columns in job search', Form::INFO); foreach (Columns::$fixed as $key => $value) { $form->add($key, $value, Form::BOOL); } $item = $id ? Group::get($id) : array(); if ($item) { $columns = explode(',', $item['columns']); foreach ($columns as $column) { $item[$column] = 1; } unset($item['columns']); } $form->values($item); if ($_POST) { $value = $form->filter($_POST); if ($value['is_admin']) { $value['show_all_jobs'] = 1; $value['allow_assign'] = 1; $value['allow_reports'] = 1; $value['allow_submissions'] = 1; $value['allow_finance'] = 1; $value['allow_forms'] = 0; $value['allow_custom_forms'] = 1; $value['edit_custom_forms'] = 1; $value['time_machine'] = 1; $value['columns'] = implode(',', array_keys(Columns::$fixed)); } else { $columns = array(); foreach (Columns::$fixed as $key => $name) { if (Arr::get($value, $key)) { $columns[] = $key; } } $value['columns'] = implode(',', $columns); } $value = array_diff_key($value, Columns::$fixed); if (!$form->validate($value)) { if ($id) { DB::update('groups')->set($value)->where('id', '=', $id)->execute(); } else { $origin = Arr::get($_POST, 'permissions'); unset($_POST['permissions']); $id = Arr::get(DB::insert('groups', array_keys($value))->values(array_values($value))->execute(), 0); DB::query(Database::INSERT, DB::expr("INSERT INTO `group_columns` (`group_id`, `column_id`, `permissions`) \n (SELECT :id, `column_id`, `permissions` FROM `group_columns` WHERE `group_id` = :origin)")->param(':id', $id)->param(':origin', $origin)->compile())->execute(); } Messages::save('Group successfully saved!', 'success'); $this->redirect('/security/groups'); } } if (!$id) { $groups = DB::select('id', 'name')->from('groups')->execute()->as_array('id', 'name'); $form->add('permissions', 'Copy permissions from group', Form::SELECT, $groups); } $this->response->body($form->render()); }
public function action_edit() { $type = $this->request->param('id'); $id = Arr::get($_GET, 'id'); $uoms = DB::select('id', 'name')->from('uoms')->execute()->as_array('id', 'name'); $form = new Form('items/edit/' . $type . '?id=' . ($id ?: '')); $form->add('code', 'Code', Form::STRING, '', array('not_empty'))->add('name', 'Name', Form::STRING, '', array('not_empty')); if ($type == 'item') { $table = 'items'; $form->add('descr', 'Description', Form::TEXT); } else { $table = 'bom_items'; } $form->add('uom', 'UOM', Form::SELECT, array(0 => 'Not selected') + $uoms); $item = DB::select()->from($table)->where('id', '=', $id)->execute()->current(); $form->values($item); if ($_POST) { $value = $form->filter($_POST); if (!$form->validate($value)) { if ($id) { DB::update($table)->set($value)->where('id', '=', $id)->execute(); } else { $id = Arr::get(DB::insert($table, array_keys($value))->values(array_values($value))->execute(), 0, 0); } $value['id'] = $id; $value['success'] = true; $value['uom'] = Arr::get($uoms, $value['uom'], 'Unknown'); if (isset($value['descr'])) { $value['descr'] = nl2br($value['descr']); } die(json_encode($value)); } } $this->response->body($form->render()); }
public function render() { if ($uid = $this->modx->getLoginUserID('web')) { $this->redirect('exitTo'); $this->renderTpl = $this->getCFGDef('skipTpl', $this->lexicon->getMsg('register.default_skipTpl')); } return parent::render(); }
public function render() { if (is_null($this->userdata)) { $this->redirect('exitTo'); $this->renderTpl = $this->getCFGDef('skipTpl', $this->lexicon->getMsg('profile.default_skipTpl')); } return parent::render(); }
public function action_edit() { $id = $this->request->param('id'); $groups = DB::select()->from('groups')->execute()->as_array('id', 'name'); $companies = DB::select()->from('companies')->execute()->as_array('id', 'name'); $form = new Form('users/edit' . ($id ? '/' . $id : '')); $form->add("login", 'Login', Form::STRING, '', array('not_empty', 'min_length' => array(':value', 4)))->add('name', 'Real Name', Form::STRING)->add('group_id', 'Group', Form::SELECT, array(0 => 'Not selected') + $groups, array('not_empty'))->add('company_id', 'Company', Form::SELECT, array(0 => 'Not selected') + $companies, array('not_empty'))->add("email", 'E-Mail', Form::STRING, '', array('not_empty', 'email'))->add('is_admin', 'Admin', Form::BOOL); $form->add('passw', 'Password', Form::PASSWORD, '', $id ? false : array('not_empty', 'min_length' => array(':value', 6)))->add('pass2', 'Confirm password', Form::PASSWORD, '', array('matches' => array(':validation', 'pass2', 'passw'))); $item = $id ? User::get($id) : array(); $form->values($item); $error = false; if ($_POST) { $item = $form->filter($_POST); $error = $form->validate($item); if (!$error) { unset($item['pass2']); $exists = DB::select('id')->from('users')->where_open()->where('login', '=', $item['login'])->or_where('email', '=', $item['email'])->where_close()->and_where('id', '<>', $id)->execute()->get('id'); if ($exists) { if ($this->request->is_ajax()) { $item['success'] = false; $item['error'] = 'exists'; header('Content-type: application/json'); die(json_encode($item)); } Messages::save("User with given login or email already exists! Please, enter different login/email!"); } else { if ($id) { if (!Arr::get($item, 'passw')) { unset($item['passw']); } DB::update('users')->set($item)->where('id', '=', $id)->execute(); } else { $result = DB::insert('users', array_keys($item))->values(array_values($item))->execute(); $id = Arr::get($result, 0); } $item['id'] = $id; $item['success'] = true; $item['group'] = Arr::get($groups, $item['group_id'], 'Unknown'); $item['company'] = Arr::get($companies, $item['company_id'], 'Unknown'); if ($this->request->is_ajax()) { header('Content-type: application/json'); die(json_encode($item)); } Messages::save('User successfully saved!', 'success'); $this->redirect('/users'); } } elseif ($this->request->is_ajax()) { $item['success'] = false; $item['error'] = $error; header('Content-type: application/json'); die(json_encode($item)); } $form->values($item); } $this->response->body($form->render($error)); }
public function getForm($type, $action, $request, $isPost = false, $errors = array()) { $form = new Form($id = 'form-picture', $name = 'form-picture', $action, 'POST', 'form-horizontal', $isPost); $form->addField('id', Lang::_('Picture Id'), 'text', $this->_getfieldvalue('id', $type, $request), true, '', @$errors['id']); $form->addField('quarter_id', Lang::_('Quarter id'), 'text', $this->_getfieldvalue('quarter_id', $type, $request), false, '', @$errors['quarter_id']); $form->addField('src', Lang::_('Src'), 'file', $this->_getfieldvalue('src', $type, $request), false, '', @$errors['src']); $form->addField('info_id', Lang::_('Info id'), 'text', $this->_getfieldvalue('info_id', $type, $request), true, '', @$errors['info_id']); $form->addField('user_id', Lang::_('User id'), 'text', $this->_getfieldvalue('user_id', $type, $request), true, '', @$errors['user_id']); return $form->render(); }
/** * Main method called by the controller. * * @param array $gp The current GET/POST parameters * @param array $errors In this class the second param is used to pass information about the email mode (HTML|PLAIN) * @return string content */ public function render($gp, $errors) { $this->currentMailSettings = $errors; $content = ''; if ($this->subparts['template']) { $this->settings = $this->globals->getSettings(); $content = parent::render($gp, []); } return $content; }
public function render() { // render("begin") or render("end") $args = func_get_args(); if ($args) { parent::render($args[0]); return; } $this->getTemplate()->_form = $this->getTemplate()->form = $this; $this->getTemplate()->render(); }
public function render(\Zend_View_Interface $view = null) { /** @var \Zend_Form_Element $element */ foreach ($this->getElements() as $element) { $label = $element->getLabel(); if (!empty($label)) { $element->setAttrib('placeholder', $label); } } return parent::render($view); }
public function getForm($type, $action, $request, $isPost = false, $errors = array()) { $form = new Form($id = 'form-comment', $name = 'form-comment', $action, 'POST', 'form-horizontal', $isPost); $form->addField('id', Lang::_('Id'), 'text', $this->_getfieldvalue('id', $type, $request), true, '', @$errors['id']); $form->addField('user_id', Lang::_('User Id'), 'text', $this->_getfieldvalue('user_id', $type, $request), true, '', @$errors['user_id']); $form->addField('quarter_id', Lang::_('Quarter Id'), 'text', $this->_getfieldvalue('quarter_id', $type, $request), false, '', @$errors['quarter_id']); $form->addField('info_id', Lang::_('Info Id'), 'text', $this->_getfieldvalue('info_id', $type, $request), false, '', @$errors['info_id']); $form->addField('content', Lang::_('Content'), 'text-area', $this->_getfieldvalue('content', $type, $request), true, '', @$errors['content']); $form->addField('photo_id', Lang::_('Photo Id'), 'file', $this->_getfieldvalue('photo_id', $type, $request), false); return $form->render(); }
public function action_edit() { $id = $this->request->param('id'); $form = new Form('security/users/edit' . ($id ? '/' . $id : '')); $groups = DB::select('id', 'name')->from('groups')->execute()->as_array('id', 'name'); $partners = DB::select('id', 'name')->from('companies')->execute()->as_array('id', 'name'); $regions = DB::select('id', 'name')->from('regions')->execute()->as_array('id', 'name'); $form->add("login", 'Login', Form::STRING, '', array('not_empty', 'min_length' => array(':value', 4)))->add("email", 'E-Mail', Form::STRING, '', array('not_empty', 'email'))->add('group_id', 'Group', Form::SELECT, array('' => 'Please select...') + $groups, array('not_empty'), array('class' => 'multiselect'))->add('company_id', 'Partner', Form::SELECT, array('' => 'None') + $partners, null, array('class' => 'multiselect'))->add('default_region', 'Default region', Form::SELECT, array(0 => 'None') + $regions, null, array('class' => 'multiselect')); $form->add('region[]', 'Available regions', Form::SELECT, $regions, null, array('multiple' => 'multiple', 'class' => 'multiselect')); $form->add('passw', 'Password', Form::PASSWORD, '', $id ? false : array('not_empty', 'min_length' => array(':value', 6)))->add('pass2', 'Confirm password', Form::PASSWORD, '', array('matches' => array(':validation', 'pass2', 'passw'))); $item = $id ? User::get($id) : array(); if ($id) { $item['region[]'] = DB::select('region_id')->from('user_regions')->where('user_id', '=', $id)->execute()->as_array(NULL, 'region_id') ?: false; } $form->values($item); $error = false; if ($_POST) { $item = $form->filter($_POST); if (!$form->validate($item)) { unset($item['pass2']); $exists = DB::select('id')->from('users')->where_open()->where('login', '=', $item['login'])->or_where('email', '=', $item['email'])->where_close()->and_where('id', '<>', $id)->execute()->get('id'); if ($exists) { Messages::save("User with given login or email already exists! Please, enter different login/email!"); } else { $regs = Arr::get($_POST, 'region'); if ($id) { if (!Arr::get($item, 'passw')) { unset($item['passw']); } DB::update('users')->set($item)->where('id', '=', $id)->execute(); DB::delete('user_regions')->where('user_id', '=', $id)->execute(); } else { $result = DB::insert('users', array_keys($item))->values(array_values($item))->execute(); $id = Arr::get($result, 0); } if ($regs) { $result = DB::insert('user_regions', array('user_id', 'region_id')); foreach ($regs as $reg) { $result->values(array($id, $reg)); } $result->execute(); } Messages::save('User successfully saved!', 'success'); $this->redirect('/security/users'); } } $form->values($item); } $this->response->body($form->render($error)); }
public function roles($params) { //Load necessary models $usersModel = Model::load("auth.users"); $usersRolesModel = Model::load("auth.users_roles"); $rolesModel = Model::load("auth.roles"); //required queries $user = $usersModel->getWithField("user_id", $params[0]); $usersRoles = $usersRolesModel->getWithField("user_id", $params[0]); $loggedInUsersRoles = $usersRolesModel->getWithField("user_id", $_SESSION['user_id']); $roles = $rolesModel->get(); $this->label = "Select Role(s) for " . $user[0]['first_name'] . " " . $user[0]['last_name']; //create a new form $form = new Form(); $form->setRenderer("table"); $fieldset = Element::create('ColumnContainer', 3); $form->add($fieldset); foreach ($roles as $role) { if ($role['role_id'] == 1) { //Boolean to determine if the outer foreach loop should "continue" particular loop or not $continueBool = false; //Loop through all the current user's foreach ($loggedInUsersRoles as $userRole) { if ($userRole['role_id'] == 1) { $continueBool = false; break; } else { $continueBool = true; } } if ($continueBool) { continue; } } $checkbox = Element::create("Checkbox", $role['role_name'], self::underscore($role['role_name']), "", $role['role_id']); foreach ($usersRoles as $userRole) { if ($userRole['role_id'] == $role['role_id']) { $checkbox->setValue($role['role_id']); } } $fieldset->add($checkbox); } $userIdHiddenField = Element::create("HiddenField", "user_id", $params[0]); $form->add($userIdHiddenField); $form->setValidatorCallback("{$this->getClassName()}::roles_callback"); $form->setShowClear(false); //render the form return $form->render(); }
/** * Панель управления */ public function admin_action() { $form = new Form("Wysiwyg/forms/config"); $options = new Core_ArrayObject(); $options->type = config('wysiwyg.editor'); $form->type->setValues(self::$editors); $form->object($options); if ($result = $form->result()) { if (isset(self::$editors[$result['type']])) { cogear()->set('wysiwyg.editor', $result['type']); success(t('Конфигурация успешно сохранена.')); } } append('content', $form->render()); }
/** * Control Panel */ public function admin() { $form = new Form("Wysiwyg.config"); $options = new Core_ArrayObject(); $options->editor = config('wysiwyg.editor'); $form->init(); $form->elements->type->setValues(self::$editors); $form->object($options); if ($result = $form->result()) { if (isset(self::$editors[$result['type']])) { cogear()->set('wysiwyg.editor', $result['type']); success('Configuration saved successfully.'); } } append('content', $form->render()); }
public function action_edit() { $id = $this->request->param('id'); if (!User::current('is_admin') && !(Group::current('item_create') && !$id) && !(Group::current('item_edit') && $id)) { throw new HTTP_Exception_403('Forbidden'); } $uoms = DB::select()->from('uoms')->execute()->as_array('id', 'name'); $form = new Form('items/edit' . ($id ? '/' . $id : '')); $form->add("sku", 'SKU/Barcode', Form::STRING, '', array('not_empty'))->add("name", 'Description', Form::STRING, '', array('not_empty'))->add("uom", 'UOM', Form::SELECT, array(0 => 'Not selected') + $uoms, array('not_empty'))->add("cost", 'Cost (each)', Form::NUMBER, '', array('not_empty'))->add("qty", 'Qty Tracked', Form::BOOL); if ($id) { $item = DB::select()->from('items')->where('id', '=', $id)->execute()->current(); } else { $item = array(); } $form->values($item); $error = false; if ($_POST) { $item = $form->filter($_POST); $error = $form->validate($item); if (!$error) { if ($id) { DB::update('items')->set($item)->where('id', '=', $id)->execute(); } else { $result = DB::insert('items', array_keys($item))->values(array_values($item))->execute(); $id = Arr::get($result, 0); } $item['id'] = $id; $item['success'] = true; if ($this->request->is_ajax()) { $item['uom'] = Arr::get($uoms, Arr::get($item, 'uom', 0), 'Unknown'); header('Content-type: application/json'); die(json_encode($item)); } Messages::save('Item successfully saved!', 'success'); $this->redirect('/items'); } elseif ($this->request->is_ajax()) { $item['success'] = false; $item['error'] = $error; header('Content-type: application/json'); die(json_encode($item)); } $form->values($item); } $this->response->body($form->render($error)); }
/** * The default page which shows the login form. * @see lib/controllers/Controller#getContents() */ public function getContents() { Application::addStylesheet("css/login.css"); Application::$template = "login.tpl"; Application::setTitle("Login"); if ($_SESSION["logged_in"]) { Application::redirect(Application::getLink("/")); } $form = new Form(); $form->setRenderer("default"); $username = new TextField("Username", "username"); $form->add($username); $password = new PasswordField("Password", "password"); $form->add($password); $form->setSubmitValue("Login"); $form->setCallback("{$this->getClassName()}::callback", $this); return $form->render(); }
public function action_edit() { $id = $this->request->param('id'); $form = new Form('groups/edit' . ($id ? '/' . $id : '')); $form->add("name", 'Name', Form::STRING, '', array('not_empty')); $roles = DB::select()->from('roles')->execute()->as_array('id', 'name'); foreach ($roles as $key => $role) { $form->add($key, $role, Form::BOOL); } $item = $id ? Group::get($id) : array(); $form->values($item); if ($_POST) { $value = $form->filter($_POST); if (!$form->validate($value)) { Database::instance()->begin(); if ($id) { DB::update('groups')->set(array('name' => $value['name']))->where('id', '=', $id)->execute(); DB::delete('group_roles')->where('group_id', '=', $id)->execute(); } else { $id = Arr::get(DB::insert('groups', array('name'))->values(array($value['name']))->execute(), 0); } $list = array(); foreach ($roles as $key => $role) { if (Arr::get($_POST, $key)) { $list[] = array($id, $key); } } if ($list) { $query = DB::insert('group_roles', array('group_id', 'role_id')); foreach ($list as $role) { $query->values($role); } $query->execute(); } Database::instance()->commit(); $value['id'] = $id; $value['success'] = true; die(json_encode($value)); //Messages::save('Group successfully saved!', 'success'); //$this->redirect('/groups'); } } $this->response->body($form->render()); }
/** * Theme admin page * * @param type $action * @param type $subaction */ public function admin($action = NULL, $subaction = NULL) { $form = new Form('Admin.theme'); if ($form->is_ajaxed) { if ($form->elements->logo->is_ajaxed) { $cogear->set('theme.logo', ''); } if ($form->elements->favicon->is_ajaxed) { $cogear->set('theme.favicon', ''); } } else { $form->setValues(array('logo' => config('theme.logo'), 'favicon' => config('theme.favicon'))); } if ($result = $form->result()) { $result->logo && $cogear->set('theme.logo', $result->logo); $result->favicon && $cogear->set('theme.favicon', $result->favicon); } append('content', $form->render()); }
public function render() { if ($uid = $this->modx->getLoginUserID('web')) { $this->redirect('exitTo'); $this->renderTpl = $this->getCFGDef('skipTpl', $this->lexicon->getMsg('reminder.default_skipTpl')); return parent::render(); } $out = ''; switch ($this->mode) { case 'hash': $out = $this->renderHash(); break; case 'reset': $out = $this->renderReset(); break; } if ($out) { return parent::render(); } }
public function action_edit() { $id = $this->request->param('id'); $form = new Form('projects/edit' . ($id ? '/' . $id : '')); $form->add("client_code", 'Client Code', Form::STRING, '', array('not_empty'))->add("internal_code", 'Internal Code', Form::STRING, '', array('not_empty'))->add("name", 'Project Name', Form::STRING, '', array('not_empty')); if ($id) { $item = DB::select()->from('projects')->where('id', '=', $id)->execute()->current(); } else { $item = array(); } $form->values($item); $error = false; if ($_POST) { $item = $form->filter($_POST); $error = $form->validate($item); if (!$error) { if ($id) { DB::update('projects')->set($item)->where('id', '=', $id)->execute(); } else { $result = DB::insert('projects', array_keys($item))->values(array_values($item))->execute(); $id = Arr::get($result, 0); } $item['id'] = $id; $item['success'] = true; if ($this->request->is_ajax()) { header('Content-type: application/json'); die(json_encode($item)); } Messages::save('Project successfully saved!', 'success'); $this->redirect('/projects'); } elseif ($this->request->is_ajax()) { $item['success'] = false; $item['error'] = $error; header('Content-type: application/json'); die(json_encode($item)); } $form->values($item); } $this->response->body($form->render($error)); }
public function action_edit() { $id = $this->request->param('id'); $form = new Form('companies/edit' . ($id ? '/' . $id : '')); $form->add("logo", 'Logo', Form::IMAGE)->add("name", 'Project Name', Form::STRING, '', array('not_empty'))->add("prefix", 'Order Number Prefix', Form::STRING, '', array('not_empty'))->add("abn", 'ABN', Form::STRING, '', array('not_empty'))->add("address", 'Address', Form::STRING, '', array('not_empty'))->add("contact", 'Contact Name', Form::STRING, '', array('not_empty'))->add("phone", 'Contact Phone', Form::STRING, '', array('not_empty'))->add("email", 'E-Mail', Form::STRING, '', array('not_empty', 'email'))->add("note", 'Note', Form::TEXT)->add("note2", 'Note2', Form::TEXT); if ($id) { $item = DB::select()->from('companies')->where('id', '=', $id)->execute()->current(); } else { $item = array(); } $form->values($item); $error = false; if ($_POST) { $item = $form->filter($_POST); $error = $form->validate($item); if (!$error) { if ($id) { DB::update('companies')->set($item)->where('id', '=', $id)->execute(); } else { $result = DB::insert('companies', array_keys($item))->values(array_values($item))->execute(); $id = Arr::get($result, 0); } $item['id'] = $id; $item['success'] = true; if ($this->request->is_ajax()) { header('Content-type: application/json'); die(json_encode($item)); } Messages::save('Company successfully saved!', 'success'); $this->redirect('/companies'); } elseif ($this->request->is_ajax()) { $item['success'] = false; $item['error'] = $error; header('Content-type: application/json'); die(json_encode($item)); } $form->values($item); } $this->response->body($form->render($error)); }
public function action_edit() { $id = $this->request->param('id'); $form = new Form('address/edit' . ($id ? '/' . $id : '')); $form->add("name", 'Site Name', Form::STRING, '', array('not_empty'))->add("address", 'Delivery Address', Form::STRING, '', array('not_empty'))->add("contact", 'Attention to', Form::STRING, '', array('not_empty'))->add("phone", 'Phone Number', Form::STRING, '', array('not_empty'))->add("note", 'Note', Form::TEXT); if ($id) { $item = DB::select()->from('address')->where('id', '=', $id)->execute()->current(); } else { $item = array(); } $form->values($item); $error = false; if ($_POST) { $item = $form->filter($_POST); $error = $form->validate($item); if (!$error) { if ($id) { DB::update('address')->set($item)->where('id', '=', $id)->execute(); } else { $result = DB::insert('address', array_keys($item))->values(array_values($item))->execute(); $id = Arr::get($result, 0); } $item['id'] = $id; $item['success'] = true; if ($this->request->is_ajax()) { header('Content-type: application/json'); die(json_encode($item)); } Messages::save('Address successfully saved!', 'success'); $this->redirect('/address'); } elseif ($this->request->is_ajax()) { $item['success'] = false; $item['error'] = $error; header('Content-type: application/json'); die(json_encode($item)); } $form->values($item); } $this->response->body($form->render($error)); }
public function action_edit() { $id = $this->request->param('id'); $form = new Form('security/companies/edit' . ($id ? '/' . $id : '')); $types = DB::select('id', 'name')->from('company_types')->execute()->as_array('id', 'name'); $form->add("name", 'Name', Form::STRING, '', array('not_empty'))->add('type', 'Company type', Form::SELECT, $types, array('not_empty')); $item = DB::select()->from('companies')->where('id', '=', $id)->execute()->current(); $form->values($item); if ($_POST) { $value = $form->filter($_POST); if (!$form->validate($value)) { if ($id) { DB::update('companies')->set($value)->where('id', '=', $id)->execute(); } else { DB::insert('companies', array_keys($value))->values(array_values($value))->execute(); } Messages::save('Company successfully saved!', 'success'); $this->redirect('/security/companies'); } } $this->response->body($form->render()); }
public function action_edit() { $id = $this->request->param('id'); $form = new Form('companies/edit' . ($id ? '/' . $id : '')); $form->add("name", 'Name', Form::STRING, '', array('not_empty')); $item = DB::select()->from('companies')->where('id', '=', $id)->execute()->current(); $form->values($item); if ($_POST) { $value = $form->filter($_POST); if (!$form->validate($value)) { Database::instance()->begin(); if ($id) { DB::update('companies')->set(array('name' => $value['name']))->where('id', '=', $id)->execute(); } else { $id = Arr::get(DB::insert('companies', array('name'))->values(array($value['name']))->execute(), 0); } Database::instance()->commit(); $value['id'] = $id; $value['success'] = true; die(json_encode($value)); } } $this->response->body($form->render()); }
$total = $data->expiry_details->sub_limit; $rem = $data->expiry_details->remaining_subs; $wtot = 100; $rem = $rem * 100 / $total; $done = 100 - $rem; if ($data->expiry_details->criteria == 'subs') { $exp_str .= '<div class="rm-formcard-expired">' . ($data->expiry_details->sub_limit - $data->expiry_details->remaining_subs) . ' out of ' . $data->expiry_details->sub_limit . ' filled' . '</div>'; } break; case 'date': $exp_str .= '<div class="rm-formcard-expired">' . $data->expiry_details->remaining_days . ' days to go' . '</div>'; break; } } $exp_str .= '</div>'; echo $exp_str; } /* * ****** End expiry drama ************ */ $form->render(); } ?> </div> <?php } else { echo RM_UI_Strings::get('MSG_NO_FIELDS'); } ?> </div>
$content = ''; foreach ($data_array as $field => $value) { if ($field == 'title') { $title = $value; } else { $content .= "<p>{$field}: {$value}</p>"; } } if ($type == 'product') { //display 'Add to Cart' button $form = new Form(); $form->addInput('pid', '', $id, 'hidden'); $form->addInput('qty', 'Quantity', 1, 'text', 2); $form->addInput('submit', null, 'Add to Cart', 'submit'); $form->setAction('cart-add.php'); $content .= $form->render(); $content .= '<p><br/><a href="index.php">Back to shopping</a></p>'; } if ($type == 'customer') { //display list of addresses $addresses = new AddressList($id); if (!empty($addresses)) { $content .= '<h3>Addresses</h3>'; foreach ($addresses as $a) { $content .= '<div class="cust-address">'; $content .= $a->getFullAddress(); $content .= '</div>'; } } } }
$user = new User(0, "", "", "", "", ""); $_SESSION["user"] = $user->getUserByID($idUser["idUser"]); header("Location: /Salon/Canal"); } else { if ($req->rowCount() == 0) { $_SESSION["erreur"][] = "Les identifiant données sont invalide."; echo "Les identifiant données sont invalide."; } else { $_SESSION["erreur"][] = "Une erreur est survenu au seins de la base de données."; echo "Une erreur est survenu au seins de la base de données."; } } if (isset($_SESSION["erreur"])) { header("Location: /Erreur"); } } ?> <?php $formConnexion = new Form("Connexion"); $formConnexion->setMethod("POST"); $formConnexion->setAction("/Portail/Connexion"); $pseudo = new Element("login", "Votre pseudo"); $password = new Element("password", "Mot de passe"); $password->setTypeElement("password"); $formConnexion->addElement($pseudo); $formConnexion->addElement($password); $formConnexion->submit("Entrez dans le Tchat"); echo $formConnexion->render();
$aDataEvent = array(); $aDataEvent['EVN_UID'] = $WE_EVN_UID; //$oData->WE_EVN_UID; $aDataEvent['EVN_RELATED_TO'] = 'MULTIPLE'; $aDataEvent['EVN_ACTION'] = $sDYNAFORM; $aDataEvent['EVN_CONDITIONS'] = $sWS_USER; $output = $oEvent->update($aDataEvent); //Show link $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; print $link; //print "\n<a href='$link' target='_new' > $link </a>"; } else { $G_FORM = new Form($sPRO_UID . '/' . $sDYNAFORM, PATH_DYNAFORM, SYS_LANG, false); $G_FORM->action = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/cases_StartExternal.php'; $scriptCode = ''; $scriptCode = $G_FORM->render(PATH_CORE . 'templates/' . 'xmlform' . '.html', $scriptCode); $scriptCode = str_replace('/controls/', $http . $_SERVER['HTTP_HOST'] . '/controls/', $scriptCode); $scriptCode = str_replace('/js/maborak/core/images/', $http . $_SERVER['HTTP_HOST'] . '/js/maborak/core/images/', $scriptCode); //render the template $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentry.tpl'; $template = new TemplatePower($pluginTpl); $template->prepare(); require_once 'classes/model/Step.php'; $oStep = new Step(); $sUidGrids = $oStep->lookingforUidGrids($sPRO_UID, $sDYNAFORM); $template->assign("URL_MABORAK_JS", G::browserCacheFilesUrl("/js/maborak/core/maborak.js")); $template->assign("URL_TRANSLATION_ENV_JS", G::browserCacheFilesUrl("/jscore/labels/" . SYS_LANG . ".js")); $template->assign("siteUrl", $http . $_SERVER["HTTP_HOST"]); $template->assign("sysSys", SYS_SYS); $template->assign("sysLang", SYS_LANG); $template->assign("sysSkin", SYS_SKIN);
/** {@inheritdoc} */ public function render(\Zend\View\Renderer\PhpRenderer $view) { $view->placeholder('BodyOnLoad')->append('document.forms["form_login"]["User"].focus()'); return parent::render($view); }
/** * It Renders content according to Part['Type'] * * @author Fernando Ontiveros Lira <*****@*****.**> * * @param intPos = 0 * @return void * */ public function RenderContent0($intPos = 0, $showXMLFormName = false) { global $G_FORM; global $G_TABLE; global $G_TMP_TARGET; global $G_OP_MENU; global $G_IMAGE_FILENAME; global $G_IMAGE_PARTS; global $_SESSION; //Changed from $HTTP_SESSION_VARS global $G_OBJGRAPH; //For graphLayout component $this->intPos = $intPos; $Part = $this->Parts[$intPos]; $this->publishType = $Part['Type']; switch ($this->publishType) { case 'externalContent': $G_CONTENT = new Content(); if ($Part['Content'] != "") { $G_CONTENT = G::LoadContent($Part['Content']); } G::LoadTemplateExternal($Part['Template']); break; case 'image': $G_IMAGE_FILENAME = $Part['File']; $G_IMAGE_PARTS = $Part['Data']; break; case 'appform': global $APP_FORM; $G_FORM = $APP_FORM; break; case 'xmlform': case 'dynaform': global $G_FORM; if ($Part['AbsolutePath']) { $sPath = $Part['AbsolutePath']; } else { if ($this->publishType == 'xmlform') { $sPath = PATH_XMLFORM; } else { $sPath = PATH_DYNAFORM; } } //if the xmlform file doesn't exists, then try with the plugins folders if (!is_file($sPath . $Part['File'] . '.xml')) { $aux = explode(PATH_SEP, $Part['File']); //check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment if (count($aux) > 2) { //Subfolders $filename = array_pop($aux); $aux0 = implode(PATH_SEP, $aux); $aux = array(); $aux[0] = $aux0; $aux[1] = $filename; } if (count($aux) == 2 && defined('G_PLUGIN_CLASS')) { $oPluginRegistry =& PMPluginRegistry::getSingleton(); if ($response = $oPluginRegistry->isRegisteredFolder($aux[0])) { if ($response !== true) { $sPath = PATH_PLUGINS . $response . PATH_SEP; } else { $sPath = PATH_PLUGINS; } } } } if (!class_exists($Part['Template']) || $Part['Template'] === 'xmlform') { $G_FORM = new Form($Part['File'], $sPath, SYS_LANG, false); } else { eval('$G_FORM = new ' . $Part['Template'] . ' ( $Part[\'File\'] , "' . $sPath . '");'); } if ($this->publishType == 'dynaform' && ($Part['Template'] == 'xmlform' || $Part['Template'] == 'xmlform_preview')) { $dynaformShow = isset($G_FORM->printdynaform) && $G_FORM->printdynaform ? 'gulliver/dynaforms_OptionsPrint' : 'gulliver/dynaforms_Options'; $G_FORM->fields = G::array_merges(array('__DYNAFORM_OPTIONS' => new XmlForm_Field_XmlMenu(new Xml_Node('__DYNAFORM_OPTIONS', 'complete', '', array('type' => 'xmlmenu', 'xmlfile' => $dynaformShow, 'parentFormId' => $G_FORM->id)), SYS_LANG, PATH_XMLFORM, $G_FORM)), $G_FORM->fields); } //Needed to make ajax calls //The action in the form tag. if (defined('ENABLE_ENCRYPT') && ENABLE_ENCRYPT == 'yes') { $G_FORM->action = urlencode(G::encrypt($Part['Target'], URL_KEY)); } else { $G_FORM->action = $Part['Target']; } if (!(isset($Part['ajaxServer']) && $Part['ajaxServer'] !== '')) { if ($this->publishType == 'dynaform') { $Part['ajaxServer'] = '../gulliver/defaultAjaxDynaform'; } else { $Part['ajaxServer'] = '../gulliver/defaultAjax'; } } if (defined('ENABLE_ENCRYPT') && ENABLE_ENCRYPT == 'yes') { $G_FORM->ajaxServer = urlencode(G::encrypt($Part['ajaxServer'], URL_KEY)); } else { $G_FORM->ajaxServer = $Part['ajaxServer']; } $G_FORM->setValues($Part['Data']); $G_FORM->setValues(array('G_FORM_ID' => $G_FORM->id)); //Asegurese de que no entre cuando $Part['Template']=="grid" //de hecho soo deberia usarse cuando $Part['Template']=="xmlform" if ($this->publishType == 'dynaform' && $Part['Template'] == "xmlform" || $Part['Template'] == "xmlform") { $G_FORM->values = G::array_merges(array('__DYNAFORM_OPTIONS' => isset($Part['Data']['__DYNAFORM_OPTIONS']) ? $Part['Data']['__DYNAFORM_OPTIONS'] : ''), $G_FORM->values); if (isset($G_FORM->nextstepsave)) { switch ($G_FORM->nextstepsave) { // this condition validates if the next step link is configured to Save and Go the next step or show a prompt case 'save': // Save and Next only if there are no required fields can submit the form. $G_FORM->values['__DYNAFORM_OPTIONS']['NEXT_ACTION'] = 'if (document.getElementById("' . $G_FORM->id . '")&&validateForm(document.getElementById(\'DynaformRequiredFields\').value)) {document.getElementById("' . $G_FORM->id . '").submit();}return false;'; break; case 'prompt': // Show Prompt only if there are no required fields can submit the form. $G_FORM->values['__DYNAFORM_OPTIONS']['NEXT_ACTION'] = 'if (document.getElementById("' . $G_FORM->id . '")&&validateForm(document.getElementById(\'DynaformRequiredFields\').value)) {if(dynaFormChanged(document.getElementsByTagName(\'form\').item(0))) {new leimnud.module.app.confirm().make({label:"@G::LoadTranslation(ID_DYNAFORM_SAVE_CHANGES)", action:function(){document.getElementById("' . $G_FORM->id . '").submit();}.extend(this), cancel:function(){window.location = getField("DYN_FORWARD").href;}.extend(this)});return false;} else {window.location = getField("DYN_FORWARD").href;return false;}}return false;'; break; } } } if (isset($_SESSION)) { $_SESSION[$G_FORM->id] = $G_FORM->values; } // by default load the core template if ($Part['Template'] == 'xmlform_preview') { $Part['Template'] = 'xmlform'; } $template = PATH_CORE . 'templates/' . $Part['Template'] . '.html'; //erik: new feature, now templates such as xmlform.html can be personalized via skins if (defined('SYS_SKIN') && strtolower(SYS_SKIN) != 'classic') { // First, verify if the template exists on Custom skins path if (is_file(PATH_CUSTOM_SKINS . SYS_SKIN . PATH_SEP . $Part['Template'] . '.html')) { $template = PATH_CUSTOM_SKINS . SYS_SKIN . PATH_SEP . $Part['Template'] . '.html'; //Second, verify if the template exists on base skins path } elseif (is_file(G::ExpandPath("skinEngine") . SYS_SKIN . PATH_SEP . $Part['Template'] . '.html')) { $template = G::ExpandPath("skinEngine") . SYS_SKIN . PATH_SEP . $Part['Template'] . '.html'; } } //end new feature if ($Part['Template'] == 'grid') { print '<form class="formDefault">'; } $scriptCode = ''; if ($this->localMode != '') { // @# las modification by erik in 09/06/2008 $G_FORM->mode = $this->localMode; } print $G_FORM->render($template, $scriptCode); if ($Part['Template'] == 'grid') { print '</form>'; } $oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher->addScriptFile($G_FORM->scriptURL); $oHeadPublisher->addScriptCode($scriptCode); /** * We've implemented the conditional show hide fields.. * * @author Erik A. Ortiz <*****@*****.**> * @date Fri Feb 19, 2009 */ if ($this->publishType == 'dynaform') { if (isset($_SESSION['CURRENT_DYN_UID']) || isset($_SESSION['CONDITION_DYN_UID'])) { require_once "classes/model/FieldCondition.php"; $oFieldCondition = new FieldCondition(); //This dynaform has show/hide field conditions if (isset($_SESSION['CURRENT_DYN_UID']) && $_SESSION['CURRENT_DYN_UID'] != '') { $ConditionalShowHideRoutines = $oFieldCondition->getConditionScript($_SESSION["CURRENT_DYN_UID"]); //lsl } else { if (isset($_SESSION['CONDITION_DYN_UID']) && $_SESSION['CONDITION_DYN_UID'] != '') { $ConditionalShowHideRoutines = $oFieldCondition->getConditionScript($_SESSION["CONDITION_DYN_UID"]); //lsl } } } } if (isset($ConditionalShowHideRoutines) && $ConditionalShowHideRoutines) { G::evalJScript($ConditionalShowHideRoutines); } break; case 'pagedtable': global $G_FORM; //if the xmlform file doesn't exists, then try with the plugins folders $sPath = PATH_XMLFORM; if (!is_file($sPath . $Part['File'])) { $aux = explode(PATH_SEP, $Part['File']); if (count($aux) == 2) { $oPluginRegistry =& PMPluginRegistry::getSingleton(); if ($oPluginRegistry->isRegisteredFolder($aux[0])) { $sPath = PATH_PLUGINS; // . $aux[0] . PATH_SEP ; } } } $G_FORM = new Form($Part['File'], $sPath, SYS_LANG, true); if (defined('ENABLE_ENCRYPT') && ENABLE_ENCRYPT == 'yes') { $G_FORM->ajaxServer = urlencode(G::encrypt($Part['ajaxServer'], URL_KEY)); } else { $G_FORM->ajaxServer = $Part['ajaxServer']; } $G_FORM->setValues($Part['Data']); if (isset($_SESSION)) { $_SESSION[$G_FORM->id] = $G_FORM->values; } G::LoadSystem('pagedTable'); $oTable = new pagedTable(); $oTable->template = 'templates/' . $Part['Template'] . '.html'; $G_FORM->xmlform = ''; $G_FORM->xmlform->fileXml = $G_FORM->fileName; $G_FORM->xmlform->home = $G_FORM->home; $G_FORM->xmlform->tree->attribute = $G_FORM->tree->attributes; $G_FORM->values = array_merge($G_FORM->values, $Part['Data']); $oTable->setupFromXmlform($G_FORM); if (isset($Part['ajaxServer']) && $Part['ajaxServer'] !== '') { $oTable->ajaxServer = $Part['ajaxServer']; } /* Start Block: Load user configuration for the pagedTable */ G::LoadClass('configuration'); $objUID = $Part['File']; $conf = new Configurations(); $conf->loadConfig($oTable, 'pagedTable', $objUID, '', isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '', ''); $oTable->__OBJ_UID = $objUID; /* End Block */ /* Start Block: PagedTable Right Click */ G::LoadClass('popupMenu'); $pm = new popupMenu('gulliver/pagedTable_PopupMenu'); $pm->name = $oTable->id; $fields = array_keys($oTable->fields); foreach ($fields as $f) { switch (strtolower($oTable->fields[$f]['Type'])) { case 'javascript': case 'button': case 'private': case 'hidden': case 'cellmark': break; default: $label = $oTable->fields[$f]['Label'] != '' ? $oTable->fields[$f]['Label'] : $f; $label = str_replace("\n", ' ', $label); $pm->fields[$f] = new XmlForm_Field_popupOption(new Xml_Node($f, 'complete', '', array('label' => $label, 'type' => 'popupOption', 'launch' => $oTable->id . '.showHideField("' . $f . '")'))); $pm->values[$f] = ''; } } $sc = ''; $pm->values['PAGED_TABLE_ID'] = $oTable->id; print $pm->render(PATH_CORE . 'templates/popupMenu.html', $sc); /* End Block */ $oTable->renderTable(); /* Start Block: Load PagedTable Right Click */ print '<script type="text/javascript">'; print $sc; print 'loadPopupMenu_' . $oTable->id . '();'; print '</script>'; /* End Block */ break; case 'propeltable': global $G_FORM; //if the xmlform file doesn't exists, then try with the plugins folders if ($Part['AbsolutePath']) { $sPath = ''; } else { $sPath = PATH_XMLFORM; } if (!is_file($sPath . $Part['File'])) { $aux = explode(PATH_SEP, $Part['File']); //search in PLUGINS folder, probably the file is in plugin if (count($aux) == 2) { $oPluginRegistry =& PMPluginRegistry::getSingleton(); if ($oPluginRegistry->isRegisteredFolder($aux[0])) { $sPath = PATH_PLUGINS; // . $aux[0] . PATH_SEP ; } } //search in PATH_DYNAFORM folder if (!is_file($sPath . PATH_SEP . $Part['File'] . '.xml')) { $sPath = PATH_DYNAFORM; } } //PATH_DATA_PUBLIC ??? if (!file_exists($sPath . PATH_SEP . $Part['File'] . '.xml') && defined('PATH_DATA_PUBLIC')) { $sPath = PATH_DATA_PUBLIC; } $G_FORM = new Form($Part['File'], $sPath, SYS_LANG, true); if (defined('ENABLE_ENCRYPT') && ENABLE_ENCRYPT == 'yes') { $G_FORM->ajaxServer = urlencode(G::encrypt($Part['ajaxServer'], URL_KEY)); } else { $G_FORM->ajaxServer = $Part['ajaxServer']; } if (isset($_SESSION)) { $_SESSION[$G_FORM->id] = $G_FORM->values; } G::LoadClass('propelTable'); $oTable = new propelTable(); $oTable->template = $Part['Template']; $oTable->criteria = $Part['Content']; if (isset($Part['ajaxServer']) && $Part['ajaxServer'] !== '') { $oTable->ajaxServer = $Part['ajaxServer']; } if (!isset($G_FORM->xmlform)) { $G_FORM->xmlform = new stdclass(); } $G_FORM->xmlform->fileXml = $G_FORM->fileName; $G_FORM->xmlform->home = $G_FORM->home; if (!isset($G_FORM->xmlform->tree)) { $G_FORM->xmlform->tree = new stdclass(); } $G_FORM->xmlform->tree->attribute = $G_FORM->tree->attributes; if (is_array($Part['Data'])) { $G_FORM->values = array_merge($G_FORM->values, $Part['Data']); } $oTable->setupFromXmlform($G_FORM); /* Start Block: Load user configuration for the pagedTable */ G::LoadClass('configuration'); $objUID = $Part['File']; $conf = new Configurations($oTable); $conf->loadConfig($oTable, 'pagedTable', $objUID, '', isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '', ''); $oTable->__OBJ_UID = $objUID; //$oTable->__OBJ_UID = ''; /* End Block */ /* Start Block: PagedTable Right Click */ G::LoadClass('popupMenu'); $pm = new popupMenu('gulliver/pagedTable_PopupMenu'); $sc = $pm->renderPopup($oTable->id, $oTable->fields); /* End Block */ //krumo ( $Part ); if ($this->ROWS_PER_PAGE) { $oTable->rowsPerPage = $this->ROWS_PER_PAGE; } try { if (is_array($Part['Data'])) { $oTable->renderTable('', $Part['Data']); } else { $oTable->renderTable(); } print $sc; } catch (Exception $e) { $aMessage['MESSAGE'] = $e->getMessage(); $this->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage); } break; case 'panel-init': global $mainPanelScript; global $panelName; global $tabCount; //G::LoadThirdParty( 'pear/json', 'class.json' ); //$json = new Services_JSON(); $tabCount = 0; $panelName = $Part['Template']; $data = $Part['File']; if (!is_array($data)) { $data = array(); } $data = G::array_merges(array('title' => '', 'style' => array(), 'left' => 'getAbsoluteLeft(mycontent)', 'top' => 'getAbsoluteTop(mycontent)', 'width' => 700, 'height' => 600, 'drag' => true, 'close' => true, 'modal' => true, 'roll' => false, 'resize' => false, 'tabWidth' => 120, 'tabStep' => 3, 'blinkToFront' => true, 'tabSpace' => 10), $data); $mainPanelScript = 'var ' . $panelName . '={},' . $panelName . 'Tabs=[];' . 'leimnud.event.add(window,"load",function(){' . $panelName . ' = new leimnud.module.panel();' . 'var mycontent=document.getElementById("' . $this->publisherId . '[' . $intPos . ']");' . $panelName . '.options={' . 'size:{w:' . $data['width'] . ',h:' . $data['height'] . '},' . 'position:{x:' . $data['left'] . ',y:' . $data['top'] . '},' . 'title:"' . addcslashes($data['title'], '\\"') . '",' . 'theme:"processmaker",' . 'statusBar:true,' . 'headerBar:true,' . 'control:{' . ' close:' . ($data['close'] ? 'true' : 'false') . ',' . ' roll:' . ($data['roll'] ? 'true' : 'false') . ',' . ' drag:' . ($data['drag'] ? 'true' : 'false') . ',' . ' resize:' . ($data['resize'] ? 'true' : 'false') . '},' . 'fx:{' . ' drag:' . ($data['drag'] ? 'true' : 'false') . ',' . ' modal:' . ($data['modal'] ? 'true' : 'false') . ',' . ' blinkToFront:' . ($data['blinkToFront'] ? 'true' : 'false') . '}' . '};' . $panelName . '.setStyle=' . Bootstrap::json_encode($data['style']) . ';' . $panelName . '.tab={' . 'width:' . ($data['tabWidth'] + $data['tabSpace']) . ',' . 'optWidth:' . $data['tabWidth'] . ',' . 'step :' . $data['tabStep'] . ',' . 'options:[]' . '};'; print ' '; break; case 'panel-tab': global $tabCount; global $mainPanelScript; global $panelName; $onChange = $Part['Content']; $beforeChange = $Part['Data']; if (SYS_LANG == 'es') { $mainPanelScript = str_replace("120", "150", $mainPanelScript); } else { $mainPanelScript = str_replace("150", "120", $mainPanelScript); } $mainPanelScript .= $panelName . 'Tabs[' . $tabCount . ']=' . 'document.getElementById("' . $Part['File'] . '");' . $panelName . '.tab.options[' . $panelName . '.tab.options.length]=' . '{' . 'title :"' . addcslashes($Part['Template'], '\\"') . '",' . 'noClear :true,' . 'content :function(){' . ($beforeChange != '' ? 'if (typeof(' . $beforeChange . ')!=="undefined") {' . $beforeChange . '();}' : '') . $panelName . 'Clear();' . $panelName . 'Tabs[' . $tabCount . '].style.display="";' . ($onChange != '' ? 'if (typeof(' . $onChange . ')!=="undefined") {' . $onChange . '();}' : '') . '}.extend(' . $panelName . '),' . 'selected:' . ($tabCount == 0 ? 'true' : 'false') . '};'; $tabCount++; break; case 'panel-close': global $mainPanelScript; global $panelName; global $tabCount; $mainPanelScript .= $panelName . '.make();'; $mainPanelScript .= 'for(var r=0;r<' . $tabCount . ';r++)' . 'if (' . $panelName . 'Tabs[r])' . $panelName . '.addContent(' . $panelName . 'Tabs[r]);'; $mainPanelScript .= '});'; $mainPanelScript .= 'function ' . $panelName . 'Clear(){'; $mainPanelScript .= 'for(var r=0;r<' . $tabCount . ';r++)' . 'if (' . $panelName . 'Tabs[r])' . $panelName . 'Tabs[r].style.display="none";}'; $oHeadPublisher =& headPublisher::getSingleton(); $oHeadPublisher->addScriptCode($mainPanelScript); break; case 'blank': print ' '; break; case 'varform': global $G_FORM; $G_FORM = new Form(); G::LoadSystem("varform"); $xml = new varForm(); //$xml->parseFile ( ); $xml->renderForm($G_FORM, $Part['File']); $G_FORM->Values = $Part['Data']; $G_FORM->SetUp($Part['Target']); $G_FORM->width = 500; break; case 'table': $G_TMP_TARGET = $Part['Target']; $G_TABLE = G::LoadRawTable($Part['File'], $this->dbc, $Part['Data']); break; case 'menu': $G_TMP_TARGET = $Part['Target']; $G_OP_MENU = new Menu(); $G_OP_MENU->Load($Part['File']); break; case 'smarty': //To do: Please check it 26/06/07 $template = new Smarty(); $template->compile_dir = PATH_SMARTY_C; $template->cache_dir = PATH_SMARTY_CACHE; $template->config_dir = PATH_THIRDPARTY . 'smarty/configs'; $template->caching = false; $dataArray = $Part['Data']; // verify if there are templates folders registered, template and method folders are the same $folderTemplate = explode('/', $Part['Template']); $oPluginRegistry =& PMPluginRegistry::getSingleton(); if ($oPluginRegistry->isRegisteredFolder($folderTemplate[0])) { $template->templateFile = PATH_PLUGINS . $Part['Template'] . '.html'; } else { $template->templateFile = PATH_TPL . $Part['Template'] . '.html'; } // last change to load the template, maybe absolute path was given if (!is_file($template->templateFile)) { $template->templateFile = strpos($Part['Template'], '.html') !== false ? $Part['Template'] : $Part['Template'] . '.html'; } //assign the variables and use the template $template $template->assign($dataArray); print $template->fetch($template->templateFile); break; case 'template': //To do: Please check it 26/06/07 if (gettype($Part['Data']) == 'array') { G::LoadSystem('template'); //template phpBB $template = new Template(); $template->set_filenames(array('body' => $Part['Template'] . '.html')); $dataArray = $Part['Data']; if (is_array($dataArray)) { foreach ($dataArray as $key => $val) { if (is_array($val)) { foreach ($val as $key_val => $val_array) { $template->assign_block_vars($key, $val_array); } } else { $template->assign_vars(array($key => $val)); } } } $template->pparse('body'); } if (gettype($Part['Data']) == 'object' && strtolower(get_class($Part['Data'])) == 'templatepower') { $Part['Data']->printToScreen(); } return; break; case 'view': case 'content': //check if G_PLUGIN_CLASS is defined, because publisher can be called without an environment $aux = explode(PATH_SEP, $Part['Template']); if (count($aux) == 2 && defined('G_PLUGIN_CLASS')) { //if the template doesn't exists, then try it with the plugins folders, after the normal Template $userTemplate = G::ExpandPath('templates') . $Part['Template']; $globalTemplate = PATH_TEMPLATE . $Part['Template']; if (!is_file($userTemplate) && !is_file($globalTemplate)) { $oPluginRegistry =& PMPluginRegistry::getSingleton(); if ($oPluginRegistry->isRegisteredFolder($aux[0])) { $pluginTemplate = PATH_PLUGINS . $Part['Template'] . '.php'; include $pluginTemplate; } } } break; case 'graphLayout': //Added by JHL to render GraphLayout component $G_OBJGRAPH = $Part['Data']; $G_TMP_TARGET = $Part['Target']; $G_TMP_FILE = $Part['File']; break; } //krumo( $Part['Template'] ); //check if this LoadTemplate is used, byOnti 12th Aug 2008 G::LoadTemplate($Part['Template']); $G_TABLE = null; }