<div id="pageTopHead"> <div class="containerBox padding4px inner"> <a href="#" class="bgLink pull-left"><?php echo I18n::_('Notifications:'); ?> <span class="bgCount">0</span></a> <span class="bgSpacer pull-left"></span> <a href="#" class="bgLink pull-left"><?php echo I18n::_('User:'******'username']; ?> </span></a> <a href="#" class="bgLink pull-right bootstrap-popover" data-toggle="popover" data-placement="bottom" data-content="<?php echo String::encodeHtml(Html::tag('a', array('href' => 'https://github.com/eserozvataf/scabbia1'), 'https://github.com/eserozvataf/scabbia1')); ?> " title="" data-original-title="<?php echo I18n::_('Scabbia Framework'), ' ', Framework::VERSION; ?> "><?php echo I18n::_('Scabbia Framework'); ?> </a> <div class="clearfix"></div> </div> </div> <div id="pageTopLogo"> <div class="containerBox inner"> <a href="<?php echo Http::url('panel');
/** * @ignore */ public static function edit($uAction, $uSlug) { Auth::checkRedirect('editor'); $tModule = AutoModels::get(Panel::$module); $tViewbag = array('module' => $tModule, 'fields' => array()); if (Request::$method === 'post') { //! todo: validations Validation::addRule('name')->isRequired()->errorMessage('Name shouldn\'t be blank.'); // Validation::addRule('slug')->isRequired()->errorMessage('Slug shouldn\'t be blank.'); if (Validation::validate($_POST)) { $tSlug = Request::post('slug', ""); if (strlen(rtrim($tSlug)) === 0) { $tSlug = Request::post('name', ""); } $tInput = array('type' => Request::post('type'), 'name' => Request::post('name'), 'slug' => String::slug(String::removeAccent($tSlug))); $tAutoModel = new AutoModel('categories'); $tAutoModel->update($uSlug, $tInput); Session::set('notification', array('info', 'ok-sign', 'Record modified.')); Http::redirect('panel/categories'); return; } Session::set('notification', array('error', 'remove-sign', Validation::getErrorMessages(true))); foreach ($tModule['fieldList'] as $tField) { $tIsView = array_key_exists('view', $tField['methods']); $tIsEdit = array_key_exists('edit', $tField['methods']); if ($tIsView || $tIsEdit) { if ($tField['type'] === 'enum') { $tTypes = array(); foreach ($tField['valueList'] as $tValue) { $tTypes[$tValue['name']] = $tValue['title']; } $tAttributes = array('name' => $tField['name'], 'class' => 'input-block-level input_' . $tField['type']); if (!$tIsEdit) { $tAttributes['readonly'] = 'readonly'; } $tTag = '<p>' . I18n::_($tField['title']) . ': ' . Html::tag('select', $tAttributes, Html::selectOptions($tTypes, Request::post($tField['name'], null))) . '</p>'; } else { $tAttributes = array('type' => 'text', 'name' => $tField['name'], 'value' => Request::post($tField['name'], ""), 'class' => 'input-block-level input_' . $tField['type']); if (!$tIsEdit) { $tAttributes['readonly'] = 'readonly'; } $tTag = '<p>' . I18n::_($tField['title']) . ': ' . Html::tag('input', $tAttributes) . '</p>'; } } $tViewbag['fields'][] = array('data' => $tField, 'html' => $tTag); } Views::viewFile('{core}views/panel/models/form.php', $tViewbag); return; } $tAutoModel = new AutoModel('categories'); $tCategory = $tAutoModel->getBySlug($tModule['name'], $uSlug); foreach ($tModule['fieldList'] as $tField) { $tIsView = array_key_exists('view', $tField['methods']); $tIsEdit = array_key_exists('edit', $tField['methods']); if ($tIsView || $tIsEdit) { if ($tField['type'] === 'enum') { $tTypes = array(); foreach ($tField['valueList'] as $tValue) { $tTypes[$tValue['name']] = $tValue['title']; } $tAttributes = array('name' => $tField['name'], 'class' => 'input-block-level input_' . $tField['type']); if (!$tIsEdit) { $tAttributes['readonly'] = 'readonly'; } $tTag = '<p>' . I18n::_($tField['title']) . ': ' . Html::tag('select', $tAttributes, Html::selectOptions($tTypes, $tCategory[$tField['name']])) . '</p>'; } else { $tAttributes = array('type' => 'text', 'name' => $tField['name'], 'value' => $tCategory[$tField['name']], 'class' => 'input-block-level input_' . $tField['type']); if (!$tIsEdit) { $tAttributes['readonly'] = 'readonly'; } $tTag = '<p>' . I18n::_($tField['title']) . ': ' . Html::tag('input', $tAttributes) . '</p>'; } } $tViewbag['fields'][] = array('data' => $tField, 'html' => $tTag); } Views::viewFile('{core}views/panel/models/form.php', $tViewbag); }