Exemplo n.º 1
0
 public function action_spam()
 {
     $id = (int) $this->request->param('id', 0);
     $question = ORM::factory('Feedback_Question', $id);
     $user_id = $this->user->id;
     if (!$question->loaded()) {
         $this->redirect('manage/feedback');
     }
     $token = Arr::get($_POST, 'token', false);
     $return = Security::xss_clean(Arr::get($_GET, 'r', 'manage/expert'));
     $this->set('return', Url::media($return));
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $question->is_spam = ($question->is_spam + 1) % 2;
         $question->spam_mod_id = $user_id;
         $question->save();
         if ($question->is_spam == 1) {
             Message::success(i18n::get('The question is marked as spam'));
         } else {
             Message::success(i18n::get('Marked "Spam" is removed from the question'));
         }
         $this->redirect($return);
     } else {
         if ($question->loaded()) {
             $this->set('question', $question)->set('token', Security::token(true));
         } else {
             $this->redirect('manage/expert');
         }
     }
 }
Exemplo n.º 2
0
 public function action_edit()
 {
     $id = $this->request->param('id', 0);
     $opinion = ORM::factory('Expert_Opinion', $id);
     $experts = ORM::factory('Expert')->order_by('name_' . I18n::$lang)->find_all();
     $user_id = $this->user->id;
     $this->set('opinion', $opinion);
     $this->set('experts', $experts);
     if ($this->request->method() == Request::POST) {
         try {
             $opinion->expert_id = Arr::get($_POST, 'expert_id', '');
             $opinion->title = Arr::get($_POST, 'title', '');
             $opinion->description = Arr::get($_POST, 'description', '');
             $opinion->text = Arr::get($_POST, 'text', '');
             $opinion->protected = Arr::get($_POST, 'protected', '');
             $opinion->date = date('Y-m-d H:i:s');
             $opinion->user_id = $user_id;
             $opinion->save();
             $event = $id ? 'edit' : 'create';
             $loger = new Loger($event, $opinion->title);
             $loger->logThis($opinion);
             Message::success(i18n::get('The position of an expert retained'));
             $this->redirect('manage/expertopinions/view/' . $opinion->id . '/page-' . $this->page);
         } catch (ORM_Validation_Exception $e) {
             $errors = $e->errors($e->alias());
             foreach ($errors as $key => $item) {
                 $errors[preg_replace("/(_ru|_kz|_en)/", '', $key)] = preg_replace("/(_ru|_kz|_en)/", '', $item);
             }
             $this->set('opinion', $_POST);
             $this->set('errors', $errors);
         }
     }
 }
Exemplo n.º 3
0
function __($string, array $values = NULL)
{
    if (i18n::$lang !== i18n::$default_lang) {
        // Get the translation for this string
        $string = i18n::get($string);
    }
    return empty($values) ? $string : strtr($string, $values);
}
Exemplo n.º 4
0
 public function delete($type)
 {
     var_dump($this);
     die;
     CategoryItemModel::load()->delete('Post_ID', Input::get('id'));
     UploadItemModel::load()->delete('Post_ID', Input::get('id'));
     PostModel::load($type)->delete('ID', Input::get('id'));
     Session::set('SUCCESS', i18n::get('FEEDBACK_SUCCESS', 'system'));
     Redirect::to($this->project_url . "admin/read/post/{$type}/");
 }
Exemplo n.º 5
0
 public function action_index()
 {
     $briefings = ORM::factory('Briefing')->where('published', '=', 1)->order_by('date', 'DESC');
     $paginate = Paginate::factory($briefings)->paginate(NULL, NULL, 10)->render();
     $briefings = $briefings->find_all();
     $this->add_cumb('Briefings', '/');
     $this->set('briefings', $briefings);
     $this->set('paginate', $paginate);
     /* метатэг description */
     $this->metadata->description(i18n::get('Брифинги по вопросам изучения истории Казахстана'));
 }
Exemplo n.º 6
0
 public function indexAction()
 {
     try {
         echo "\r\n <br /> hello, i'm indexAction in controller_index, nice 2 meet u! <br />\r\n ";
         echo "\r\n <br /> now set language to zh-cn! <br />\r\n ";
         i18n::setLanguage('en-us');
         echo "\r\n <br /> in english, my name is: " . i18n::get('author') . " <br />\r\n ";
         echo "\r\n <br /> now set language to zh-cn! <br />\r\n ";
         i18n::setLanguage('zh-cn');
         echo "\r\n <br /> in chinese, my name is: " . i18n::get('author') . " <br />\r\n ";
         $mDemo = new model_demo();
         $uin = 10000;
         $uinfo = $mDemo->getUserInfo($uin);
         $uinfo2 = $mDemo->getUserInfo2($uin);
         $update = $mDemo->updateInfo(6, 1);
         var_dump($uinfo, $uinfo2, $update);
         $confs = array('title' => 'page title', 'time' => date('Ymd H:i:s'), 'name' => 'ricolau');
         log::add('error', 'im test~!');
     } catch (exception_i18n $e) {
         //i18n 的异常,一般是由于语言包不存在
         $code = $e->getCode();
         if ($code == exception_i18n::type_language_not_exist) {
             echo "\r\n <br /> exception: language of " . i18n::getLanguage() . ' not exist!\\r\\n <br />';
         }
         echo $e->getMessage();
     } catch (Exception $e) {
         //如果实在还是有exception,那就捕捉到这里吧,ignore 忽略处理的话。代码继续执行 $this->render(),不会白页。
         //throw $e;  //如果把这个异常抛上去,当前页面就木有了,上层接收到的话自己处理就好了,比如报个异常啥的
         $code = $e->getCode();
         echo $e->getMessage();
     }
     //一般来说 render 这块儿可以不用 try 和 cache,只有 template 或 slot 不存在才会有异常而已。
     //但是建议和上面部分业务代码的try cache 结构分离,从而可以更好的决定,如果业务数据有问题,页面是否还继续render()
     try {
         //按变量单独 assign
         $this->assign('uinfo', $uinfo);
         $this->assign('updateresult', $update);
         //批量assign 一个数组可以!
         $this->massign($confs);
         $this->render();
     } catch (exception_render $e) {
         //一般来说这个exception  不会有,模板放好了就行了么
         $code = $e->getCode();
         if ($code == exception_render::type_tpl_not_exist) {
             echo '\\r\\n <br /> exception: template not exist!\\r\\n <br />';
         } elseif ($code == exception_render::type_slot_not_exist) {
             echo '\\r\\n <br /> exception: template not exist!\\r\\n <br />';
         }
         echo $e->getMessage();
     }
     // equals to $this->render('index', 'index');
     return;
     //绝对不要用 exit!!!!!
 }
Exemplo n.º 7
0
 public function action_page()
 {
     $id = (int) $this->request->param('id', 0);
     $publication = ORM::factory('Publication', $id);
     if (!$publication->loaded()) {
         throw new HTTP_Exception_404();
     }
     $this->add_cumb(i18n::get('Тайны казахских орнаментов'), 'ornek');
     $this->add_cumb($publication->title, 'ornek');
     $this->set('item', $publication);
 }
Exemplo n.º 8
0
 public function action_page()
 {
     $id = (int) $this->request->param('id', 0);
     $publication = ORM::factory('Publication', $id);
     if (!$publication->loaded()) {
         throw new HTTP_Exception_404();
     }
     $this->add_cumb(i18n::get('Шежире – древо единства казахов'), 'shezhire');
     $this->add_cumb($publication->title, 'shezhire');
     $this->set('item', $publication);
 }
Exemplo n.º 9
0
 function getList()
 {
     $application = Application::getInstance();
     $registry = Registry::getInstance();
     $i18n = new i18n($registry->get('i18n_path') . 'router.xml');
     $renderer = new Renderer(Page::MODE_NORMAL);
     $pTitle = $i18n->get('title');
     $renderer->page->set('title', $pTitle)->set('h1', $pTitle)->set('content', RouterListView::get(['list' => Router::getList()]));
     $renderer->loadPage();
     $renderer->output();
 }
Exemplo n.º 10
0
 public function action_index()
 {
     $courses = ORM::factory('Education')->where('language', '=', $this->language)->where('published', '=', 1)->order_by('number');
     $paginate = Paginate::factory($courses)->paginate(NULL, NULL, 30)->render();
     $courses = $courses->find_all();
     $this->set('paginate', $paginate);
     $this->set('courses', $courses);
     $this->add_cumb('Цифровые образовательные ресурсы', false);
     /* метатэг description */
     $this->metadata->description(i18n::get('Цифровые образовательные ресурсы, интерактивные материалы, интерактивные тесты'));
 }
Exemplo n.º 11
0
 public function action_page()
 {
     $id = (int) $this->request->param('id', 0);
     $publication = ORM::factory('Publication', $id);
     if (!$publication->loaded()) {
         throw new HTTP_Exception_404();
     }
     $this->add_cumb(i18n::get('Краеведение'), 'olketanu');
     $this->add_cumb($publication->title, 'olketanu');
     $this->set('item', $publication);
 }
Exemplo n.º 12
0
 public function action_add()
 {
     $search = $this->request->param('string', "");
     $id = $this->request->param('material_id', 0);
     $id_project = $this->request->param('project_id', 0);
     $type = $this->request->param('type', 0);
     $article = ORM::factory('Material_Project');
     $article->material_id = $id;
     $article->project_id = $id_project;
     $article->type = $type;
     $article->save();
     Message::success(i18n::get('Материал успешно добавлен в спец.проект!'));
     $this->redirect('manage/search/' . $id_project . '/all/' . $search);
 }
Exemplo n.º 13
0
 public function __construct()
 {
     // construct controller
     parent::__construct();
     // set urls
     $this->data['project_url'] = Router::getProjectUrl();
     $this->data['current_url'] = Router::getUrl();
     // set date format
     $this->data['date_format'] = App::load()->date_format;
     //set admin nav
     App::load()->register('nav', array(" \n  <div class='list-group panel'> \n    <a href='#post' class='list-group-item list-group-item-info' data-toggle='collapse'>" . i18n::get('POST_HEADER', 'post') . "</a> \n    <div class='collapse' id='post'> \n       <a href='" . $this->data['project_url'] . "admin/read/post/article/' class='list-group-item'>" . i18n::get('POST_SUB_HEADER', 'post') . "</a> \n      <a href='" . $this->data['project_url'] . "admin/create/post/article/' class='list-group-item'>" . i18n::get('POST_CREATE', 'post') . "</a> \n    </div> \n  </div>"));
     // set default includes
     $this->header = PATH_APP_VIEWS . 'admin/default/assets/inc/_header';
     $this->sidebar = PATH_APP_VIEWS . 'admin/default/assets/inc/_sidebar';
     $this->footer = PATH_APP_VIEWS . 'admin/default/assets/inc/_footer';
 }
Exemplo n.º 14
0
 public function main()
 {
     try {
         echo "\r\n <br /> hello, i'm indexAction in Controller_Index, nice 2 meet u! <br />\r\n ";
         echo "\r\n <br /> now set language to zh-cn! <br />\r\n ";
         i18n::setLanguage('en-us');
         echo "\r\n <br /> in english, my name is: " . i18n::get('author') . " <br />\r\n ";
         echo "\r\n <br /> now set language to zh-cn! <br />\r\n ";
         i18n::setLanguage('zh-cn');
         echo "\r\n <br /> in chinese, my name is: " . i18n::get('author') . " <br />\r\n ";
         $mDemo = new Model_Demo();
         $uin = 10000;
         $uinfo = $mDemo->getUserInfo($uin);
         $uinfo2 = $mDemo->getUserInfo2($uin);
         $update = $mDemo->updateInfo(6, 1);
         var_dump($uinfo, $uinfo2, $update);
     } catch (Exception $e) {
         Tools_Exceptionhandler::topDeal($e);
     }
 }
Exemplo n.º 15
0
 public function action_edit()
 {
     $id = $this->request->param('id', 0);
     $expert = ORM::factory('Expert', $id);
     if ($expert->loaded()) {
         $flag = true;
     } else {
         $flag = false;
     }
     $user_id = $this->user->id;
     $uploader = View::factory('storage/image')->set('user_id', $user_id)->render();
     $this->set('uploader', $uploader);
     $this->set('expert', $expert);
     $this->set('page', $this->page);
     if ($this->request->method() == Request::POST) {
         try {
             $expert->name = Arr::get($_POST, 'name', '');
             $expert->image = (int) Arr::get($_POST, 'image', '');
             $expert->description = Arr::get($_POST, 'description', '');
             $expert->position = Arr::get($_POST, 'position', '');
             $expert->date = date('Y-m-d H:i:s');
             $expert->user_id = $user_id;
             $expert->save();
             if (!$flag) {
                 $list = ORM::factory('Expert');
                 $paginate = Paginate::factory($list);
                 $list = $list->find_all();
                 $this->page = $paginate->page_count();
             }
             Message::success(i18n::get('The expert retained'));
             $this->redirect('manage/expert/view/' . $expert->id . '/page-' . $this->page);
         } catch (ORM_Validation_Exception $e) {
             $errors = $e->errors($e->alias());
             foreach ($errors as $key => $item) {
                 $errors[preg_replace("/(_ru|_kz|_en)/", '', $key)] = preg_replace("/(_ru|_kz|_en)/", '', $item);
             }
             $this->set('expert', $_POST);
             $this->set('errors', $errors);
         }
     }
 }
Exemplo n.º 16
0
 public function action_index()
 {
     $this->add_cumb(i18n::get("Мультимедиа"), '');
 }
Exemplo n.º 17
0
 function validate($values = null)
 {
     $values = pick($values, $this->populate());
     foreach ($this->schema as $field) {
         $input_id = $this->model_name . '_' . $field->name;
         $input_value = $values[$input_id];
         // Required error (not primary key, not foreign key and null or zero length string)
         if (!$field->primaryKey && !$field->foreignKey && $field->required && ($input_value === null || strlen($input_value) === 0)) {
             $this->errors[$input_id] = i18n::get('This field is required.');
             continue;
         } elseif (!$field->required && ($input_value === null || strlen($input_value) === 0)) {
             continue;
         }
         // Validate via regex, validation template or field type
         $regex = $field->regex ? 'regex' : null;
         $validation_type = pick($regex, $field->template, $field->type);
         switch ($validation_type) {
             // Regex matching
             case 'regex':
                 // Regex error
                 if (!preg_match($field->regex, $input_value)) {
                     $this->errors[$input_id] = i18n::get('Please type a valid value for this field.');
                     continue;
                 }
                 break;
                 // Numeric template
             // Numeric template
             case 'numeric':
             case 'int':
             case 'tinyint':
                 // Non-numeric error
                 if ($input_value !== null && !is_numeric($input_value)) {
                     $this->errors[$input_id] = i18n::get('This field accepts numbers only.');
                     continue;
                 }
                 break;
                 // E-mail template
             // E-mail template
             case 'email':
                 // E-mail error
                 $email_regex = '/^[a-zA-Z0-9._-]+@[a-zA-Z0-9][a-zA-Z0-9._-]+.[a-zA-Z0-9._-]{2,}$/';
                 if (!preg_match($email_regex, $input_value)) {
                     $this->errors[$input_id] = i18n::get('Please type a valid e-mail address.');
                     continue;
                 }
                 break;
                 // Currency template
             // Currency template
             case 'currency':
             case 'decimal':
                 // Currency error
                 $currency_regex = '/^[0-9,.]+$/';
                 if ($input_value !== null && !preg_match($currency_regex, $input_value)) {
                     $this->errors[$input_id] = i18n::get('Please type a valid amount.');
                     continue;
                 }
                 break;
                 // Field type: varchar, text
             // Field type: varchar, text
             case 'varchar':
             case 'text':
                 $length = strlen($input_value);
                 // Minlength error
                 if ($field->minlength && $length < $field->minlength) {
                     $this->errors[$input_id] = i18n::get('This field requires at least %0 characters.', array($field->minlength));
                     continue;
                 }
                 // Maxlength error
                 if ($field->maxlength && $length > $field->maxlength) {
                     $this->errors[$input_id] = i18n::get('This field\'s maximun length is %0 characters.', array($field->maxlength));
                 }
                 break;
             case 'datetime':
                 break;
             default:
                 print '<p><strong>Unhandled field type "' . $field->type . '"</strong></p>';
         }
     }
     if (count($this->errors) === 0) {
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 18
0
 public function action_profile()
 {
     $total = (int) Arr::get($_POST, 'total', 0);
     $lang = Security::xss_clean(trim(strip_tags(Arr::get($_POST, 'lang', ''))));
     $child = ORM::factory('Page')->where('parent_id', '=', $total)->order_by('id', 'ASC')->find_all();
     $data = array();
     $data[$total] = i18n::get('For All', $lang);
     $name = "name_" . $lang;
     foreach ($child as $item) {
         $data[$item->id] = $item->{$name};
     }
     $this->response->body(json_encode($data));
 }
Exemplo n.º 19
0
 public function action_deletesubscription()
 {
     if (!Auth::instance()->logged_in()) {
         $this->redirect('/', 301);
     }
     $user_id = $this->user->id;
     $id = (int) $this->request->param('id', 0);
     $subscription = ORM::factory('Subscription', $id);
     if ($subscription->user_id == $user_id) {
         $subscription->delete();
         Message::success(i18n::get('Subscribe removed'));
     }
     $this->redirect('profile/subscription', 301);
 }
Exemplo n.º 20
0
 public function action_add()
 {
     if ($this->request->method() == Request::POST) {
         try {
             $id = $this->request->param('id', 0);
             $article = ORM::factory('Material_Project');
             $article->material_id = $id;
             $article->project_id = Arr::get($_POST, 'category_id');
             $article->save();
         } catch (ORM_Validation_Exception $e) {
         }
         Message::success(i18n::get('The material sent to the moderator. Thank you!'));
     }
 }
Exemplo n.º 21
0
<?php 
$this->slot('index/section');
?>
<br /><br />


######## show i18n use here ################

current language is: <?php 
echo i18n::language();
?>
<br /><br />

the author's gender is:<?php 
echo i18n::get('gender');
?>
<br /><br />

and the vget of i18n is: <?php 
echo i18n::vget('telltime', array($title, $time));
?>
<br /><br />



######## show render data below ################

hi, the title is: <?php 
echo $title;
?>
Exemplo n.º 22
0
 public function action_spam()
 {
     $id = (int) $this->request->param('id', 0);
     $question = ORM::factory('Expert_Question', $id);
     $user_id = $this->user->id;
     $cancel_url = Url::media('manage/expertquestions/page-' . $this->page . '?sort=' . $this->sort);
     $token = Arr::get($_POST, 'token', false);
     $this->set('return', Url::media('manage/expertquestions/reply/' . $id . 'page-' . $this->page . '?sort=' . $this->sort));
     if ($this->request->method() == Request::POST && Security::token() === $token) {
         $question->is_spam = 1;
         $question->moderator_id = $user_id;
         $question->save();
         Message::success(i18n::get('The question is marked as spam'));
         $this->redirect($cancel_url);
     } else {
         if ($question->loaded()) {
             $this->set('question', $question)->set('token', Security::token(true));
         } else {
             $this->redirect($cancel_url);
         }
     }
 }
Exemplo n.º 23
0
/**
 * i18n if
 *
 * @param type $text
 * @param type $translate
 * @return string
 */
function i18n_if($text, $translate)
{
    if ($translate) {
        return i18n::get(null, $text);
    } else {
        return $text;
    }
}
Exemplo n.º 24
0
 public function action_add()
 {
     $id = $this->request->param('material_id', 0);
     $id_project = $this->request->param('project_id', 0);
     $article = ORM::factory('Material_Project');
     $article->material_id = $id;
     $article->project_id = $id_project;
     $article->save();
     //$this->redirect('/manage/search/'.$id_project, 301);
     Message::success(i18n::get('The material sent to the moderator. Thank you!'));
 }
Exemplo n.º 25
0
 public function action_edit()
 {
     $id = (int) $this->request->param('id', 0);
     $debate = ORM::factory('Debate', $id);
     if (!$debate->loaded() or $debate->admin_create) {
         $this->redirect('manage/debate');
     }
     $this->set('debate', $debate);
     if ($this->request->method() == Request::POST) {
         $old_title = $debate->title;
         $old_description = $debate->description;
         try {
             $debate->title = Arr::get($_POST, 'title', '');
             $debate->description = Arr::get($_POST, 'description', '');
             $debate->save();
             Message::success(i18n::get('Дебаты сохранены'));
             if ($old_title != $debate->title) {
                 $this->log($debate->id, 'title', $old_title, $debate->title);
             }
             if ($old_description != $debate->description) {
                 $this->log($debate->id, 'description', $old_description, $debate->description);
             }
             $this->redirect('manage/debate');
         } catch (ORM_Validation_Exception $e) {
             $errors = $e->errors($e->alias());
             $this->set('debate', $_POST);
             $this->set('errors', $errors);
         }
     }
 }
Exemplo n.º 26
0
 public function action_questions()
 {
     $list = ORM::factory('Expert_Question')->where('is_answered', '=', 1);
     $search = Security::xss_clean(Arr::get($_POST, 'search', ''));
     if (!empty($search)) {
         $list->and_where('question', 'LIKE', '%' . $search . '%');
     }
     $list = $list->order_by('date', 'DESC');
     $paginate = Paginate::factory($list)->paginate(NULL, NULL, 10)->render();
     $list = $list->find_all();
     $this->set('search', $search);
     $this->set('list', $list);
     $this->set('paginate', $paginate);
     if ($this->request->method() == Request::POST) {
         if (Auth::instance()->logged_in()) {
             try {
                 $user_id = Auth::instance()->get_user()->id;
                 $question = ORM::factory('Expert_Question');
                 $question->user_id = $user_id;
                 $question->question = Arr::get($_POST, 'question', '');
                 $question->date = date('Y-m-d H:i:s');
                 $question->save();
             } catch (ORM_Validation_Exception $e) {
             }
         } else {
             Message::success(i18n::get('You have to login'));
         }
     }
     $this->add_cumb('Question-answer', '/');
 }
Exemplo n.º 27
0
    <div class="table-responsive"> 
        <?php 
    Table::start("class='table table-striped'");
    Table::head(array('ID', i18n::get('POST_TITLE', $this->controller), i18n::get('POST_CREATED', $this->controller), i18n::get('POST_UPDATED', $this->controller), i18n::get('POST_AUTHOR', $this->controller), i18n::get('POST_ACTIONS', $this->controller)));
    foreach ($this->results->data as $view) {
        // Check dates
        $updated = "";
        $created = "";
        if ($view->Updated < 0) {
            $updated = date($this->date_format, $view->Updated);
        }
        if ($view->Created > 0) {
            $created = date($this->date_format, $view->Created);
        }
        $form = "<form action='" . $this->project_url . "admin/delete/post/" . $this->type . "' method='post' onsubmit=\"return confirm('Er du sikker?')\"><input type='hidden' name='id' value='" . $view->ID . "'>" . "<input type='submit' value='" . i18n::get('POST_DELETE', $this->controller) . "' class='btn btn-danger'></form>";
        Table::data(array("#" . $view->ID, $view->Title . " <small>(" . $view->Slug . ")</small>", $created, $updated, " <small>(" . $view->Username . ")</small>", "<a class='btn btn-success' href='" . $this->project_url . 'admin/update/post/' . $this->type . '/' . $view->ID . "'>" . i18n::get('POST_UPDATE', $this->controller) . "</a>", $form));
    }
    Table::end();
    ?>
 
    </div> 
    <p>Sider:</p> 
    <?php 
    for ($x = 1; $x <= $this->results->total; $x++) {
        ?>
 
        <a class="btn btn-default" href="<?php 
        echo $this->project_url . "admin/read/post/{$this->type}/" . $x;
        ?>
"><?php 
        echo $x;
Exemplo n.º 28
0
 public static function size($size)
 {
     $file = round($size / (1024 * 1024), 2);
     return $file . " " . i18n::get('MB');
 }
Exemplo n.º 29
0
 public function action_comment()
 {
     $id = (int) $this->request->param('id', 0);
     $return = Security::xss_clean(Arr::get($_GET, 'r', 'debate/view/' . $id));
     if ($this->request->method() == Request::POST) {
         try {
             if (Auth::instance()->logged_in()) {
                 $user_id = Auth::instance()->get_user()->id;
                 $comment = Arr::get($_POST, 'comment', '');
                 $debate = ORM::factory('Debate_Comment');
                 $debate->debate_id = $id;
                 $debate->date = date('Y-m-d H:i:s');
                 $debate->comment = $comment;
                 $debate->user_id = $user_id;
                 $debate->save();
                 $debate = ORM::factory('Debate', $id);
                 $debate->comments_count += 1;
                 $debate->save();
                 Message::success(i18n::get('Your comment has been saved, thanks!'));
             }
         } catch (ORM_Validation_Exception $e) {
         }
         $this->redirect($return, 301);
     }
 }
Exemplo n.º 30
0
Form::textarea('body', " class='form-control'", Input::exists(Input::get('body')));
foreach ($this->results->categories as $cat) {
    if ($cat->Parent_ID == 0 || $cat->ID == $cat->Parent_ID) {
        $options[] = Form::options($cat->ID, '-' . $cat->Label);
    } else {
        $options[] = Form::options($cat->ID, $cat->Label);
    }
}
if (isset($this->results->uploads)) {
    $path = $this->project_url . '/public/uploads/thumbs/';
    foreach ($this->results->uploads as $upload) {
        $selected = '';
        $thumb = '';
        foreach ($this->results->upload_item as $upload_item) {
            $thumb = $path . $upload->Slug;
            if ($upload_item->Upload_ID == $upload->ID) {
                $selected = "selected ";
            }
        }
        $uploads[] = Form::options($upload->ID, $upload->Slug, $selected . "data-img-src='{$thumb}'");
    }
}
Form::label('category', i18n::get('POST_CAT', $this->controller), "class='control-label'");
Form::select('category[]', $options, "multiple class='form-control'");
if (isset($uploads)) {
    Form::label('upload', i18n::get('POST_IMAGE', $this->controller), "class='control-label'");
    Form::select('upload[]', $uploads, "id='upload'  multiple class='form-control'");
}
Form::space(1);
Form::submit('submit', i18n::get('POST_SAVE', $this->controller), "class='form-control btn-success'");
Form::end();