本文整理汇总了PHP中Gekosale\App::getModel方法的典型用法代码示例。如果您正苦于以下问题:PHP App::getModel方法的具体用法?PHP App::getModel怎么用?PHP App::getModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gekosale\App
的用法示例。
在下文中一共展示了App::getModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _addFieldsContentTypeMainCategoriesBox
public function _addFieldsContentTypeMainCategoriesBox($form, $boxContent)
{
$ct_MainCategoriesBox = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'ct_MainCategoriesBox', 'label' => _('TXT_LAYOUT_BOX_CONTENT_SETTINGS'))));
$ct_MainCategoriesBox->AddDependency(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $boxContent, new FormEngine\Conditions\Equals('MainCategoriesBox')));
$showall = $ct_MainCategoriesBox->AddChild(new FormEngine\Elements\Select(array('name' => 'showall', 'label' => 'Pokazuj kategorie', 'options' => array(new FormEngine\Option('1', 'Wszystkie'), new FormEngine\Option('0', 'Wybrane')))));
$ct_MainCategoriesBox->AddChild(new FormEngine\Elements\Tree(array('name' => 'categoryIds', 'label' => 'Kategoria', 'selectable' => true, 'sortable' => false, 'clickable' => false, 'items' => App::getModel('category')->getParentCategories(), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $showall, new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals(1)))))));
}
示例2: initForm
public function initForm()
{
$form = new FormEngine\Elements\Form(array('name' => 'contentcategory', 'action' => '', 'method' => 'post'));
$requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'required_data', 'label' => _('TXT_MAIN_DATA'))));
$languageData = $requiredData->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data', 'label' => _('TXT_LANGUAGE_DATA'))));
$languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'name', 'label' => _('TXT_NAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME'))))));
$languageData->AddChild(new FormEngine\Elements\RichTextEditor(array('name' => 'description', 'label' => _('TXT_CONTENT'))));
$requiredData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'header', 'label' => _('TXT_ENABLE_IN_HEADER'), 'default' => '1')));
$requiredData->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'footer', 'label' => _('TXT_ENABLE_IN_FOOTER'), 'default' => '1')));
$requiredData->AddChild(new FormEngine\Elements\Tip(array('direction' => FormEngine\Elements\Tip::DOWN, 'tip' => '<p>' . _('TXT_PARENT_CATEGORY_EXAMPLE') . '</p>')));
$requiredData->AddChild(new FormEngine\Elements\Tree(array('name' => 'contentcategoryid', 'label' => _('TXT_CATEGORY'), 'choosable' => true, 'selectable' => false, 'sortable' => false, 'clickable' => false, 'restrict' => (int) $this->registry->core->getParam(), 'items' => App::getModel('contentcategory')->getContentCategoryALL($this->registry->core->getParam()))));
$metaData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'meta_data', 'label' => _('TXT_META_INFORMATION'))));
$metaData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">W przypadku braku informacji META system wygeneruje je automatycznie. W każdej chwili możesz je zmienić edytując dane poniżej.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
$languageData = $metaData->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data', 'label' => _('TXT_LANGUAGE_DATA'))));
$languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'keyword_title', 'label' => _('TXT_KEYWORD_TITLE'))));
$languageData->AddChild(new FormEngine\Elements\Textarea(array('name' => 'keyword_description', 'label' => _('TXT_KEYWORD_DESCRIPTION'))));
$languageData->AddChild(new FormEngine\Elements\Textarea(array('name' => 'keyword', 'label' => _('TXT_KEYWORDS'), 'comment' => _('TXT_KEYWORDS_HELP'))));
$redirectData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'redirect_data', 'label' => _('TXT_CONTENTCATEGORY_REDIRECT'))));
$redirect = $redirectData->AddChild(new FormEngine\Elements\Select(array('name' => 'redirect', 'label' => _('TXT_REDIRECT_TYPE'), 'options' => array(new FormEngine\Option(0, _('TXT_REDIRECT_NONE')), new FormEngine\Option(1, _('TXT_REDIRECT_INTERNAL')), new FormEngine\Option(2, _('TXT_REDIRECT_EXTERNAL'))), 'default' => 1)));
$redirectData->AddChild(new FormEngine\Elements\Select(array('name' => 'redirect_route', 'label' => _('TXT_REDIRECT_INTERNAL_URL'), 'options' => array(new FormEngine\Option('frontend.mainside', _('TXT_CONTROLLER_MAINSIDE')), new FormEngine\Option('frontend.conditions', _('TXT_CONDITIONS')), new FormEngine\Option('frontend.clientlogin', _('TXT_CONTROLLER_CLIENTLOGIN')), new FormEngine\Option('frontend.registration', _('TXT_CONTROLLER_REGISTRATION')), new FormEngine\Option('frontend.contact', _('TXT_CONTROLLER_CONTACT')), new FormEngine\Option('frontend.sitemap', _('TXT_CONTROLLER_SITEMAP')), new FormEngine\Option('frontend.news', _('TXT_CONTROLLER_NEWS')), new FormEngine\Option('frontend.forgotpassword', _('TXT_CONTROLLER_FORGOTPASSWORD')), new FormEngine\Option('frontend.producerlist', _('TXT_CONTROLLER_PRODUCERLIST')), new FormEngine\Option('frontend.categorylist', _('TXT_CONTROLLER_CATEGORYLIST'))), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $redirect, new FormEngine\Conditions\Equals(1))), 'default' => 1)));
$redirectData->AddChild(new FormEngine\Elements\TextField(array('name' => 'redirect_url', 'label' => _('TXT_REDIRECT_EXTERNAL_URL'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $redirect, new FormEngine\Conditions\Equals(2))))));
$layerData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'view_data', 'label' => _('TXT_STORES'))));
$layerData->AddChild(new FormEngine\Elements\LayerSelector(array('name' => 'view', 'label' => _('TXT_VIEW'), 'default' => Helper::getViewIdsDefault())));
$Data = Event::dispatch($this, 'admin.contentcategory.initForm', array('form' => $form, 'id' => (int) $this->registry->core->getParam(), 'data' => $this->populateData));
if (!empty($Data)) {
$form->Populate($Data);
}
$form->AddFilter(new FormEngine\Filters\Trim());
$form->AddFilter(new FormEngine\Filters\Secure());
return $form;
}
示例3: initForm
public function initForm()
{
$controllers = array();
$controllersRaw = App::getModel('groups')->getFullPermission();
foreach ($controllersRaw as $controller) {
$controllers[] = array('name' => $controller['name'], 'id' => $controller['id']);
}
$actions = array();
$actionsRaw = $this->registry->right->getRightsToSmarty();
foreach ($actionsRaw as $right) {
$actions[] = array('name' => $right['name'], 'id' => $right['value']);
}
$form = new FormEngine\Elements\Form(array('name' => 'group', 'action' => '', 'method' => 'post'));
$basicData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'basic_data', 'label' => _('TXT_BASIC_GROUP_DATA'))));
$basicData->AddChild(new FormEngine\Elements\TextField(array('name' => 'name', 'label' => _('TXT_GROUP_NAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_GROUP_NAME')), new FormEngine\Rules\Unique(_('ERR_DUPLICATE_GROUP_NAME'), '`group`', 'name', null, array('column' => 'idgroup', 'values' => (int) $this->registry->core->getParam()))))));
$rightsData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'rights_data', 'label' => _('TXT_RIGHTS'))));
$rightsData->AddChild(new FormEngine\Elements\RightsTable(array('name' => 'rights', 'label' => _('TXT_GROUP_RIGHTS'), 'controllers' => $controllers, 'actions' => $actions)));
$Data = Event::dispatch($this, 'admin.groups.initForm', array('form' => $form, 'id' => (int) $this->registry->core->getParam(), 'data' => $this->populateData));
if (!empty($Data)) {
$form->Populate($Data);
}
$form->AddFilter(new FormEngine\Filters\Trim());
$form->AddFilter(new FormEngine\Filters\Secure());
return $form;
}
示例4: index
public function index()
{
if (Session::getActiveUserid() != null) {
App::redirect(__ADMINPANE__ . '/mainside');
}
$form = new FormEngine\Elements\Form(array('name' => 'forgotlogin', 'action' => '', 'method' => 'post', 'class' => 'login-form'));
$form->AddChild(new FormEngine\Elements\TextField(array('name' => 'login', 'label' => _('TXT_EMAIL_FORM_LOGIN'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_LOGIN_FORM_LOGIN'))))));
$form->AddChild(new FormEngine\Elements\Submit(array('name' => 'log_in', 'label' => _('TXT_FORGOT_PASSWORD'))));
$form->AddFilter(new FormEngine\Filters\Trim());
$form->AddFilter(new FormEngine\Filters\NoCode());
if ($form->Validate(FormEngine\FE::SubmittedData())) {
$loginValues = $form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT);
$result = App::getModel('login')->checkUsers($loginValues['login']);
if ($result == 0) {
Session::setVolatileLoginError(1, false);
} else {
$password = Core::passwordGenerate();
App::getModel('login')->changeUsersPassword($result, $password);
$this->registry->template->assign('password', $password);
App::getModel('mailer')->sendEmail(array('template' => 'forgotUsers', 'email' => array($_POST['login']), 'bcc' => false, 'subject' => _('TXT_FORGOT_PASSWORD'), 'viewid' => Helper::getViewId()));
Session::setVolatileMessage("Nowe hasło zostało wysłane na podany adres e-mail.");
App::redirect('login');
}
}
$error = Session::getVolatileLoginError();
if ($error[0] == 1) {
$this->registry->template->assign('error', _('ERR_BAD_EMAIL'));
}
$languages = App::getModel('language')->getLanguages();
$this->registry->xajax->processRequest();
$this->registry->template->assign('xajax', $this->registry->xajax->getJavascript());
$this->registry->template->assign('form', $form->Render());
$this->registry->template->assign('languages', json_encode($languages));
$this->registry->template->display($this->loadTemplate('index.tpl'));
}
示例5: initForm
public function initForm()
{
$form = new FormEngine\Elements\Form(array('name' => 'currencieslist', 'action' => '', 'method' => 'post'));
$requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'required_data', 'label' => _('TXT_MAIN_DATA'))));
$requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'name', 'label' => _('TXT_CURRENCY_NAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME'))))));
$requiredData->AddChild(new FormEngine\Elements\Select(array('name' => 'symbol', 'label' => _('TXT_CURRENCY_SYMBOL'), 'options' => FormEngine\Option::Make(App::getModel('currencieslist')->getCurrenciesALLToSelect()), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_CURRENCY_SYMBOL'))))));
$requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'decimalseparator', 'label' => _('TXT_CURRENCY_DECIMAL_SEPARATOR'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_CURRENCY_DECIMAL_SEPARATOR'))))));
$requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'decimalcount', 'label' => _('TXT_CURRENCY_DECIMAL_COUNT'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_CURRENCY_DECIMAL_COUNT'))))));
$requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'thousandseparator', 'label' => _('TXT_CURRENCY_THOUSAND_SEPARATOR'))));
$requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'positivepreffix', 'label' => _('TXT_CURRENCY_POSITIVE_PREFFIX'))));
$requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'positivesuffix', 'label' => _('TXT_CURRENCY_POSITIVE_SUFFIX'))));
$requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'negativepreffix', 'label' => _('TXT_CURRENCY_NEGATIVE_PREFFIX'))));
$requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'negativesuffix', 'label' => _('TXT_CURRENCY_NEGATIVE_SUFFIX'))));
$exchangeData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'exchange_data', 'label' => _('TXT_CURRENCY_EXCHANGE'))));
$currencies = App::getModel('currencieslist')->getCurrencies();
foreach ($currencies as $key => $currency) {
$exchangeData->AddChild(new FormEngine\Elements\TextField(array('name' => 'currency_' . $currency['idcurrency'], 'label' => $currency['currencysymbol'], 'filters' => array(new FormEngine\Filters\CommaToDotChanger()))));
}
$layerData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'view_data', 'label' => _('TXT_STORES'))));
$layerData->AddChild(new FormEngine\Elements\LayerSelector(array('name' => 'view', 'label' => _('TXT_VIEW'), 'default' => Helper::getViewIdsDefault())));
$Data = Event::dispatch($this, 'admin.currencieslist.initForm', array('form' => $form, 'id' => (int) $this->registry->core->getParam(), 'data' => $this->populateData));
if (!empty($Data)) {
$form->Populate($Data);
}
$form->AddFilter(new FormEngine\Filters\NoCode());
$form->AddFilter(new FormEngine\Filters\Secure());
return $form;
}
示例6: initForm
public function initForm()
{
$form = new FormEngine\Elements\Form(array('name' => 'language', 'action' => '', 'method' => 'post'));
$requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'required_data', 'label' => _('TXT_MAIN_DATA'))));
$requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'name', 'label' => _('TXT_NAME'), 'comment' => _('TXT_EXAMPLE') . ': en_EN', 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME')), new FormEngine\Rules\Unique(_('ERR_NAME_ALREADY_EXISTS'), 'language', 'name', null, array('column' => 'idlanguage', 'values' => (int) $this->registry->core->getParam()))))));
$requiredData->AddChild(new FormEngine\Elements\TextField(array('name' => 'translation', 'label' => _('TXT_TRANSLATION'), 'comment' => _('TXT_EXAMPLE') . ': TXT_ENGLISH', 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_TRANSLATION'))))));
if ($this->registry->core->getParam() == '') {
$requiredData->AddChild(new FormEngine\Elements\Select(array('name' => 'copylanguage', 'label' => _('TXT_COPY_FROM_LANGUAGE'), 'options' => FormEngine\Option::Make($this->registry->core->getDefaultValueToSelect() + App::getModel('language')->getLanguageALLToSelect()), 'default' => 0)));
}
$requiredData->AddChild(new FormEngine\Elements\LocalFile(array('name' => 'translations', 'label' => 'Plik z tłumaczeniem', 'file_source' => 'upload/', 'file_types' => array('xml'))));
$currencies = App::getModel('currencieslist')->getCurrencyForSelect();
$currencyData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'currency_data', 'label' => _('TXT_CURRENCY_DATA'))));
$currencyData->AddChild(new FormEngine\Elements\Select(array('name' => 'currencyid', 'label' => _('TXT_DEFAULT_LANGUAGE_CURRENCY'), 'options' => FormEngine\Option::Make($currencies))));
$flagPane = $form->addChild(new FormEngine\Elements\Fieldset(array('name' => 'flag_pane', 'label' => _('TXT_LANGUAGE_FLAG'))));
$flagPane->AddChild(new FormEngine\Elements\LocalFile(array('name' => 'flag', 'label' => _('TXT_LANGUAGE_FLAG'), 'file_source' => 'design/_images_common/icons/languages/', 'file_types' => array('png'))));
$layerData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'view_data', 'label' => _('TXT_STORES'))));
$layerData->AddChild(new FormEngine\Elements\LayerSelector(array('name' => 'view', 'label' => _('TXT_VIEW'), 'default' => Helper::getViewIdsDefault())));
$Data = Event::dispatch($this, 'admin.language.initForm', array('form' => $form, 'id' => (int) $this->registry->core->getParam(), 'data' => $this->populateData));
if (!empty($Data)) {
$form->Populate($Data);
}
$form->AddFilter(new FormEngine\Filters\NoCode());
$form->AddFilter(new FormEngine\Filters\Trim());
$form->AddFilter(new FormEngine\Filters\Secure());
return $form;
}
示例7: confirm
public function confirm()
{
$param = base64_decode($this->registry->core->getParam());
$Data = App::getModel('mainside')->search($param);
$html = '<div class="livesearch-results">';
if (isset($Data['orders'])) {
$html .= '<h3>Zamówienia:</h3>';
$html .= '<ul>';
foreach ($Data['orders'] as $key => $result) {
$html .= $result;
}
$html .= '</ul>';
}
if (isset($Data['clients'])) {
$html .= '<h3>Klienci:</h3>';
$html .= '<ul>';
foreach ($Data['clients'] as $key => $result) {
$html .= $result;
}
$html .= '</ul>';
}
if (isset($Data['products'])) {
$html .= '<h3>Produkty:</h3>';
$html .= '<ul>';
foreach ($Data['products'] as $key => $result) {
$html .= $result;
}
$html .= '</ul>';
}
$html .= '</div>';
echo $html;
}
示例8: getPaymentMethodConfigurationForm
public function getPaymentMethodConfigurationForm($event, $request)
{
if ($request['data']['paymentmethodmodel'] != $this->getName()) {
return false;
}
$payu =& $request['form']->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'payu_data', 'label' => 'Konfiguracja')));
$payu->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>Wprowadź dane punktu płatności. Adresy konieczne do ustawienia przy jego tworzeniu to:</p>
<ul>
<li>Adres powrotu - błąd: <strong>' . $this->registry->router->generate('frontend.payment', true, array('action' => 'cancel', 'param' => 'platnosci')) . '</strong></li>
<li>Adres powrotu - poprawnie: <strong>' . $this->registry->router->generate('frontend.payment', true, array('action' => 'confirm', 'param' => 'platnosci')) . '</strong></li>
<li>Adres raportów: <strong>' . $this->registry->router->generate('frontend.payment', true, array('action' => 'report', 'param' => 'platnosci')) . '</strong></li>
</ul>')));
$payu->AddChild(new FormEngine\Elements\TextField(array('name' => 'idpos', 'label' => 'Id punktu płatności (pos_id)')));
$payu->AddChild(new FormEngine\Elements\Password(array('name' => 'firstmd5', 'label' => 'Klucz (MD5)')));
$payu->AddChild(new FormEngine\Elements\TextField(array('name' => 'secondmd5', 'label' => 'Drugi klucz (MD5)')));
$payu->AddChild(new FormEngine\Elements\TextField(array('name' => 'authkey', 'label' => 'Klucz autoryzacji płatności (pos_auth_key)')));
$statuses = App::getModel('orderstatus')->getOrderStatusToSelect();
$payu->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p>Ustaw powiązania statusów PayU ze sklepem</p>')));
foreach ($this->_statusMap as $id => $name) {
$payu->AddChild(new FormEngine\Elements\Select(array('name' => 'payu_status_' . $id, 'label' => $name, 'options' => FormEngine\Option::Make($statuses))));
}
$settings = $this->registry->core->loadModuleSettings('payu', Helper::getViewId());
if (!empty($settings)) {
$populate = array('payu_data' => array('idpos' => $settings['idpos'], 'firstmd5' => $settings['firstmd5'], 'secondmd5' => $settings['secondmd5'], 'authkey' => $settings['authkey']));
foreach ($this->_statusMap as $id => $name) {
if (isset($settings['payu_status_' . $id])) {
$populate['payu_data']['payu_status_' . $id] = $settings['payu_status_' . $id];
}
}
$event->setReturnValues($populate);
}
}
示例9: importPagescheme
public function importPagescheme($file)
{
$file = ROOTPATH . 'themes' . DS . $file;
require_once ROOTPATH . 'lib' . DS . 'zip' . DS . 'zip.php';
$archive = new PclZip($file);
$this->targetFolder = 'temp' . date('YmdHis');
$archive->extract(PCLZIP_OPT_PATH, ROOTPATH . 'themes' . DS . $this->targetFolder);
$info = $this->getMainInfo();
$seo = Core::clearUTF(trim($info['name']));
$seo = preg_replace('/[^A-Za-z0-9\\-\\s\\s+]/', '', $seo);
$seo = Core::clearSeoUTF($seo);
$this->templateFolder = str_replace('/', '', strtolower($seo));
if (is_dir(ROOTPATH . 'themes' . DS . $this->templateFolder)) {
$this->templateFolder = $this->templateFolder . date('YmdHis');
$info['name'] = $info['name'] . ' (Kopia ' . date('Y-m-d H:i:s') . ')';
}
rename(ROOTPATH . 'themes' . DS . $this->targetFolder, ROOTPATH . 'themes' . DS . $this->templateFolder);
$this->getImportData();
Db::getInstance()->beginTransaction();
if (!empty($this->importData)) {
$this->pageSchemeId = App::getModel('pagescheme')->addPageScheme(array('name' => $info['name'], 'templatefolder' => $this->templateFolder));
$this->saveBoxes($this->importData['boxes'], $this->pageSchemeId);
$this->saveSubpages($this->importData['layouts'], $this->pageSchemeId);
}
Db::getInstance()->commit();
$this->clearCache(ROOTPATH . DS . 'serialization', false);
$this->clearCache(ROOTPATH . DS . 'cache', false);
}
示例10: __construct
public function __construct($registry, $box)
{
parent::__construct($registry, $box);
$this->cartModel = App::getModel('cart');
$this->paymentModel = App::getModel('payment');
$this->deliveryModel = App::getModel('delivery');
}
示例11: edit
public function edit()
{
$rawGroupData = $this->model->getGroupsView((int) $this->id);
if (empty($rawGroupData)) {
App::redirect(__ADMINPANE__ . '/groups');
}
$controllers = array();
$controllersRaw = App::getModel('groups')->getFullPermission();
foreach ($controllersRaw as $controller) {
$controllers[] = array('name' => $controller['name'], 'id' => $controller['id']);
}
$actions = array();
$actionsRaw = $this->registry->right->getRightsToSmarty();
foreach ($actionsRaw as $right) {
$actions[] = array('name' => $right['name'], 'id' => $right['value']);
}
$rightsData = array();
foreach ($controllersRaw as $controller) {
$mask = 1;
$rights = array();
for ($i = 0; $i < count($actions); $i++) {
$rights[$actions[$i]['id']] = $controller['permission'] & $mask ? 1 : 0;
$mask = $mask << 1;
}
$rightsData[$controller['id']] = $rights;
}
$populateData = array('basic_data' => array('name' => $rawGroupData['name']), 'rights_data' => array('rights' => $rightsData));
$this->formModel->setPopulateData($populateData);
$form = $this->formModel->initForm();
if ($form->Validate(FormEngine\FE::SubmittedData())) {
$this->model->editPermission($form->getSubmitValues(), $this->id);
App::redirect(__ADMINPANE__ . '/groups');
}
$this->renderLayout(array('form' => $form->Render()));
}
示例12: index
public function index()
{
$Config = App::getConfig();
$configData = array('config_data' => array('admin_panel_link' => __ADMINPANE__, 'ssl' => (string) (isset($Config['ssl']) && $Config['ssl'] == 1) ? 1 : 0), 'gallerysettings_data' => App::getModel('globalsettings')->getGallerySettings());
$settingsData = App::getModel('globalsettings')->getSettings();
$colour = $settingsData['gallerysettings_data']['colour'];
unset($settingsData['gallerysettings_data']);
$settingsData['gallerysettings_data']['colour'] = array('type' => 1, 'start' => $colour);
$this->formModel->setPopulateData(array_merge_recursive($configData, $settingsData));
$form = $this->formModel->initForm();
if ($form->Validate(FormEngine\FE::SubmittedData())) {
try {
$Data = $form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT);
$Settings = $form->getSubmitValues();
Event::notify($this, 'admin.globalsettings.model.save', array('id' => 1, 'data' => $Data));
App::getModel('globalsettings')->updateGallerySettings($Data);
App::getModel('globalsettings')->updateGlobalSettings($Settings['interface'], 'interface');
App::getModel('globalsettings')->updateGlobalSettings(array('colour' => $Settings['gallerysettings_data']['colour']['start']), 'gallerysettings_data');
Session::setActiveGlobalSettings(NULL);
App::getModel('globalsettings')->configWriter($Data);
if (__ADMINPANE__ != $Data['admin_panel_link']) {
Session::flush();
App::redirect('');
} else {
App::redirect(__ADMINPANE__ . '/globalsettings');
}
} catch (Exception $e) {
$this->registry->template->assign('error', $e->getMessage());
}
}
$this->renderLayout(array('form' => $form->Render()));
}
示例13: add
public function add()
{
$form = new FormEngine\Elements\Form(array('name' => 'promotion', 'action' => '', 'method' => 'post'));
$requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'required_data', 'label' => _('TXT_SELECT_PRODUCTS'))));
$productid = $requiredData->AddChild(new FormEngine\Elements\ProductSelect(array('name' => 'productid', 'label' => _('TXT_SELECT_PRODUCTS'), 'rules' => array(new FormEngine\Rules\Required(_('TXT_SELECT_PRODUCTS'))), 'repeat_min' => 1, 'repeat_max' => FormEngine\FE::INFINITE)));
$pricePane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'discount_pane', 'label' => _('TXT_DISCOUNT'))));
$standardPrice = $pricePane->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'standard_price', 'label' => _('TXT_STANDARD_SELLPRICE'))));
$enablePromotion = $standardPrice->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'promotion', 'label' => _('TXT_ENABLE_PROMOTION'), 'default' => '0')));
$standardPrice->AddChild(new FormEngine\Elements\TextField(array('name' => 'discount', 'label' => _('TXT_DISCOUNT'), 'rules' => array(new FormEngine\Rules\Format(_('ERR_VALUE_INVALID'), '/^([0-9]*\\.*([0-9]{1,2})|(\\0)?)$/')), 'default' => '0.00', 'suffix' => '%', 'filters' => array(new FormEngine\Filters\CommaToDotChanger()), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $enablePromotion, new FormEngine\Conditions\Equals(1))))));
$standardPrice->AddChild(new FormEngine\Elements\Date(array('name' => 'promotionstart', 'label' => _('TXT_START_DATE'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $enablePromotion, new FormEngine\Conditions\Equals(1))))));
$standardPrice->AddChild(new FormEngine\Elements\Date(array('name' => 'promotionend', 'label' => _('TXT_END_DATE'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $enablePromotion, new FormEngine\Conditions\Equals(1))))));
$clientGroups = App::getModel('clientgroup/clientgroup')->getClientGroupAll();
foreach ($clientGroups as $clientGroup) {
$pricePane->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'field_' . $clientGroup['id'], 'label' => $clientGroup['name'])));
$promotion[$clientGroup['id']] = $pricePane->AddChild(new FormEngine\Elements\Checkbox(array('name' => 'promotion_' . $clientGroup['id'], 'label' => _('TXT_ENABLE_CLIENTGROUP_PROMOTION'), 'default' => '0')));
$pricePane->AddChild(new FormEngine\Elements\TextField(array('name' => 'discount_' . $clientGroup['id'], 'label' => _('TXT_DISCOUNT'), 'rules' => array(new FormEngine\Rules\Format(_('ERR_VALUE_INVALID'), '/^([0-9]*\\.*([0-9]{1,2})|(\\0)?)$/')), 'default' => '0.00', 'suffix' => '%', 'filters' => array(new FormEngine\Filters\CommaToDotChanger()), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::HIDE, $promotion[$clientGroup['id']], new FormEngine\Conditions\Not(new FormEngine\Conditions\Equals(1)))))));
$pricePane->AddChild(new FormEngine\Elements\Date(array('name' => 'promotionstart_' . $clientGroup['id'], 'label' => _('TXT_START_DATE'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $promotion[$clientGroup['id']], new FormEngine\Conditions\Equals(1))))));
$pricePane->AddChild(new FormEngine\Elements\Date(array('name' => 'promotionend_' . $clientGroup['id'], 'label' => _('TXT_END_DATE'), 'dependencies' => array(new FormEngine\Dependency(FormEngine\Dependency::SHOW, $promotion[$clientGroup['id']], new FormEngine\Conditions\Equals(1))))));
}
$form->AddFilter(new FormEngine\Filters\NoCode());
$form->AddFilter(new FormEngine\Filters\Trim());
$form->AddFilter(new FormEngine\Filters\Secure());
if ($form->Validate(FormEngine\FE::SubmittedData())) {
$Data = $form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT);
$this->model->addPromotion($Data);
App::getModel('product')->updateProductAttributesetPricesAll();
App::redirect(__ADMINPANE__ . '/productpromotion');
}
$this->registry->template->assign('form', $form->Render());
$this->registry->template->assign('xajax', $this->registry->xajax->getJavascript());
$this->registry->xajax->processRequest();
$this->registry->template->display($this->loadTemplate('add.tpl'));
}
示例14: edit
public function edit()
{
$form = new FormEngine\Elements\Form(array('name' => 'rangetype', 'action' => '', 'method' => 'post'));
$requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'required_data', 'label' => _('TXT_MAIN_DATA'))));
$languageData = $requiredData->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data', 'label' => _('TXT_LANGUAGE_DATA'))));
$languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'name', 'label' => _('TXT_NAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME')), new FormEngine\Rules\LanguageUnique(_('ERR_NAME_ALREADY_EXISTS'), 'rangetypetranslation', 'name', null, array('column' => 'rangetypeid', 'values' => (int) $this->registry->core->getParam()))))));
$categoryData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'category_data', 'label' => _('TXT_CATEGORY_DATA'))));
$rawRangetypeData = App::getModel('rangetype')->getRangeTypeView($this->registry->core->getParam());
$categoryData->AddChild(new FormEngine\Elements\Tree(array('name' => 'category', 'label' => _('TXT_CATEGORY'), 'choosable' => false, 'selectable' => true, 'sortable' => false, 'clickable' => false, 'items' => App::getModel('category')->getChildCategories(0, $rawRangetypeData['rangetypecategorys']), 'load_children' => array(App::getModel('category'), 'getChildCategories'))));
$form->AddFilter(new FormEngine\Filters\NoCode());
$form->AddFilter(new FormEngine\Filters\Trim());
$form->AddFilter(new FormEngine\Filters\Secure());
$rangetypeData = array('required_data' => array('language_data' => $rawRangetypeData['language']), 'category_data' => array('category' => $rawRangetypeData['rangetypecategorys']));
$form->Populate($rangetypeData);
if ($form->Validate(FormEngine\FE::SubmittedData())) {
try {
App::getModel('rangetype')->editRangeType($form->getSubmitValues(FormEngine\Elements\Form::FORMAT_FLAT), $this->registry->core->getParam());
} catch (Exception $e) {
$this->registry->template->assign('error', $e->getMessage());
}
App::redirect(__ADMINPANE__ . '/rangetype');
}
$this->registry->template->assign('form', $form->Render());
$this->registry->xajax->processRequest();
$this->registry->template->assign('xajax', $this->registry->xajax->getJavascript());
$this->registry->template->display($this->loadTemplate('edit.tpl'));
}
示例15: initForm
public function initForm()
{
$form = new FormEngine\Elements\Form(array('name' => 'producer', 'action' => '', 'method' => 'post'));
$requiredData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'required_data', 'label' => _('TXT_MAIN_DATA'))));
$languageData = $requiredData->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data', 'label' => _('TXT_LANGUAGE_DATA'))));
$languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'name', 'label' => _('TXT_NAME'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_NAME')), new FormEngine\Rules\LanguageUnique(_('ERR_NAME_ALREADY_EXISTS'), 'producertranslation', 'name', null, array('column' => 'producerid', 'values' => (int) $this->registry->core->getParam()))))));
$languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'seo', 'label' => _('TXT_SEO_URL'), 'rules' => array(new FormEngine\Rules\Required(_('ERR_EMPTY_SEO_URL'))))));
$languageData->AddChild(new FormEngine\Elements\RichTextEditor(array('name' => 'description', 'label' => _('TXT_DESCRIPTION'), 'rows' => 10)));
$requiredData->AddChild(new FormEngine\Elements\MultiSelect(array('name' => 'deliverer', 'label' => _('TXT_DELIVERER'), 'options' => FormEngine\Option::Make(App::getModel('deliverer')->getDelivererToSelect()))));
$requiredData->AddChild(new FormEngine\Elements\StaticText(array('text' => '<p style="padding-left: 195px;"><a href="' . App::getURLAdressWithAdminPane() . 'deliverer/add' . '" target="_blank"><span>' . _('TXT_ADD_DELIVERER') . '</span></a></p>')));
$metaData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'meta_data', 'label' => _('TXT_META_INFORMATION'))));
$metaData->AddChild(new FormEngine\Elements\Tip(array('tip' => '<p align="center">W przypadku braku informacji META system wygeneruje je automatycznie. W każdej chwili możesz je zmienić edytując dane poniżej.</p>', 'direction' => FormEngine\Elements\Tip::DOWN)));
$languageData = $metaData->AddChild(new FormEngine\Elements\FieldsetLanguage(array('name' => 'language_data', 'label' => _('TXT_LANGUAGE_DATA'))));
$languageData->AddChild(new FormEngine\Elements\TextField(array('name' => 'keyword_title', 'label' => _('TXT_KEYWORD_TITLE'))));
$languageData->AddChild(new FormEngine\Elements\Textarea(array('name' => 'keyword_description', 'label' => _('TXT_KEYWORD_DESCRIPTION'), 'comment' => _('TXT_MAX_LENGTH') . ' 1000', 'max_length' => 1000)));
$languageData->AddChild(new FormEngine\Elements\Textarea(array('name' => 'keyword', 'label' => _('TXT_KEYWORDS'), 'comment' => _('TXT_KEYWORDS_HELP'))));
$photosPane = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'photos_pane', 'label' => _('TXT_SINGLE_PHOTO'))));
$photosPane->AddChild(new FormEngine\Elements\Image(array('name' => 'photo', 'label' => _('TXT_SINGLE_PHOTO'), 'repeat_min' => 0, 'repeat_max' => 1, 'upload_url' => App::getURLAdressWithAdminPane() . 'files/add')));
$layerData = $form->AddChild(new FormEngine\Elements\Fieldset(array('name' => 'view_data', 'label' => _('TXT_STORES'))));
$layerData->AddChild(new FormEngine\Elements\LayerSelector(array('name' => 'view', 'label' => _('TXT_VIEW'), 'default' => Helper::getViewIdsDefault())));
$Data = Event::dispatch($this, 'admin.producer.initForm', array('form' => $form, 'id' => (int) $this->registry->core->getParam(), 'data' => $this->populateData));
if (!empty($Data)) {
$form->Populate($Data);
}
$form->AddFilter(new FormEngine\Filters\Trim());
$form->AddFilter(new FormEngine\Filters\Secure());
return $form;
}