public function actionCreate()
 {
     $model = new Faq();
     $description = new FaqDescription();
     if (isset($_POST['FaqDescription'])) {
         $suc = Yii::t('info', 'Attribute was successfully created');
         $err = Yii::t('info', 'Could not update Attribute');
         $description->setAttributes($_POST['FaqDescription']);
         $description->faq_id = 0;
         $description->locale_code = Yii::app()->getLanguage();
         if ($model->validate() && $description->validate()) {
             if ($model->save()) {
                 $description->faq_id = $model->id;
                 $description->save();
                 Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_SUCCESS, $suc);
                 if (Yii::app()->getRequest()->getIsAjaxRequest()) {
                     $this->renderPartial('_view', array('model' => $model), false, true);
                     Yii::app()->end();
                 } else {
                     $this->redirect(array('view', 'model' => $model));
                 }
             } else {
                 Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_ERROR, $err);
             }
         }
     }
     $this->render('create', array('model' => $model, 'description' => $description, 'title' => $description));
 }
Exemple #2
0
 function delete($id = FALSE)
 {
     if ($id) {
         $faq = new Faq($id);
         $faq->delete();
         set_notify('success', lang('delete_data_complete'));
     }
     redirect($_SERVER['HTTP_REFERER']);
 }
Exemple #3
0
 /**
  * The support index handler.
  * 
  * @access public
  * @return string The HTML code.
  */
 public function index()
 {
     $Page = $this->getContentPage();
     $Award = new Award();
     $Faq = new Faq();
     $Article = new Article();
     $params = array();
     $params[] = 'Type = ' . Article::ARTICLE;
     $params[] = 'PostedAt < ' . time();
     $params[] = $Article->getParam('reference', $Page);
     $this->getView()->set(array('Documents' => $Page->getDocuments(), 'Faqs' => $Faq->findList(array(), 'Position asc'), 'Papers' => $Award->findList(array('Type = ' . Award::SUPPORT), 'Position asc'), 'Articles' => $Article->findList($params, 'PostedAt desc')));
     return $this->getView()->render();
 }
Exemple #4
0
 public function createAction()
 {
     $entity = new Faq();
     $entity->load_from_array($this->request->getParam("faq"));
     if (save_faq($entity)) {
         $this->flash->setSuccess("New Question added successfully!");
         $this->redirect_to(project_show_path($entity->project_id));
     } else {
         $this->flash->setError("There was an error saving the question. Both fields are required.");
         //$this->render(array("entity" => $entity), "new");
         $this->redirect_to(project_show_path($entity->project_id));
     }
 }
 public function loadModel($id)
 {
     if (($model = Faq::model()->findByPk($id)) === null) {
         throw new CHttpException(404, 'Страница не найдена');
     }
     return $model;
 }
Exemple #6
0
 function ask()
 {
     if ($_POST) {
         $tree = Tree::getIdTreeByModule('faq');
         $model = new Faq();
         if ($model->ask($tree) === true) {
             $this->redirect('/faq/thanks/');
             View::render('faq/ask', $tree);
         }
     } else {
         $tree = Tree::getTreeByUrl('wide');
         Funcs::setMeta($tree);
         $tree['rubrics'] = Faq::getRubricsTree($tree['parent']);
         View::render('faq/ask', $tree);
     }
 }
 public function actionIndex()
 {
     $categoryId = $this->iGet('category_id', 1);
     $model = new Faq();
     $model->unsetAttributes();
     $model->category_id = $categoryId;
     $model->status = Faq::STATUS_SHOW;
     $categories = FaqCategory::getCategoryMenu();
     $this->title = Yii::t('common', 'Frequently Asked Questions');
     $this->pageTitle = array($this->title);
     if ($model->category) {
         $this->pageTitle = array($this->title, $model->category->getAttributeValue('name'));
     }
     $this->breadcrumbs = array('FAQ');
     $this->render('index', array('model' => $model, 'categories' => $categories));
 }
Exemple #8
0
 public function index($request)
 {
     $data = [];
     $data['faqs'] = Faq::find('all', ['conditions' => ['showed' => 1]]);
     $data['empty'] = empty($data['faqs']);
     return new ViewResponse('faq/index', $data);
 }
Exemple #9
0
 function AdminFaq($row)
 {
     Module::Module($row);
     if (User::is_admin()) {
         switch (Url::get('cmd')) {
             case 'remove_faq':
                 $id = Url::get('id', 0);
                 if (empty($id)) {
                     Url::redirect_url('admin_faq.html');
                     exit;
                 }
                 Faq::delete_faq($id);
                 Url::redirect_url('admin_faq.html');
                 break;
             case 'edit_faq':
                 require_once 'forms/Edit.php';
                 $this->add_form(new EditFaqForm());
                 break;
             case 'list_faq':
                 require_once 'forms/List.php';
                 $this->add_form(new ListFaqForm());
                 break;
             default:
                 require_once 'forms/List.php';
                 $this->add_form(new ListFaqForm());
                 break;
         }
     } else {
         Url::access_denied();
     }
 }
Exemple #10
0
/**
 * Обработка тега модуля
 *
 * @param int $id идентификатор рубрики вопросов и ответов
 */
function mod_faq($id)
{
    global $AVE_Template;
    $AVE_Template->caching = 1;
    // Включаем кеширование
    $AVE_Template->cache_lifetime = -1;
    // Неограниченное время жизни кэша
    //	$AVE_Template->cache_dir .= '/faq'; // Папка для кеша модуля
    $tpl_dir = BASE_DIR . '/modules/faq/templates/';
    // Путь к шаблону модуля
    // Если нету в кеше, то начинаем обрабатывать
    if (!$AVE_Template->is_cached($tpl_dir . 'show_faq.tpl', $id)) {
        // Проверяем, есть ли папка для кеша, если нет (первый раз) — создаем
        if (!is_dir($AVE_Template->cache_dir)) {
            $oldumask = umask(0);
            @mkdir($AVE_Template->cache_dir, 0777);
            umask($oldumask);
        }
        require_once BASE_DIR . '/modules/faq/class.faq.php';
        Faq::faqShow($id);
    }
    echo rewrite_link($AVE_Template->fetch($tpl_dir . 'show_faq.tpl', $id));
    $AVE_Template->caching = false;
    // Отключаем кеширование
}
 public function index()
 {
     $faqs = Faq::where('Status', '=', 'Active')->get();
     $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all();
     $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all();
     $data['about'] = About::get()->all();
     return View::make('faqs.index', compact('faqs'))->with('data', $data);
 }
Exemple #12
0
 public function run()
 {
     DB::table('faqs')->truncate();
     DB::table('faqs')->delete();
     for ($i = 0; $i < 20; $i++) {
         Faq::create(array('user_id' => '1', 'title' => 'Тестовый вопрос - ' . $i, 'content' => 'Тестовый ответ - ' . $i, 'active' => 1, 'meta_title' => 'Тестовый ответ мета заголовок - ' . $i, 'meta_description' => 'Тестовый вопрос мета описание - ' . $i, 'meta_keywords' => 'Тестовый вопрос ключевые слова - ' . $i, 'published_at' => '2015-01-28 16:50:01'));
     }
 }
 public function deleteQuestion($id)
 {
     $question = Faq::find($id);
     Faq::destroy($id);
     Session::flash('flash_msg', "La question " . $question->idFAQ . " a bien été supprimée.");
     Session::flash('flash_type', "warning");
     return Redirect::to('/admin/faq');
 }
Exemple #14
0
 public function destroy($id, $request)
 {
     $result = Faq::exists($id);
     if ($result) {
         $faq = Faq::find($id);
         $faq->erase();
     }
     return new JsonResponse(['result' => $result]);
 }
Exemple #15
0
 public function faq()
 {
     $faq = Faq::all();
     // POUR PAGE TYPE
     $lastActu = Actualites::orderBy('dateActualite', 'desc')->take(1)->get();
     $lastInfo = Alerte::orderBy('dateAlerte', 'desc')->take(1)->get();
     //--------------------
     return View::make('public.pages.faq')->with('faq', $faq)->with('lastActu', $lastActu)->with('lastInfo', $lastInfo);
 }
Exemple #16
0
 function draw()
 {
     global $display;
     $list_faq = Faq::get_collection(null, null, " sort ASC");
     $list_faq = Util::removeKey($list_faq);
     $display->add('list_faq', $list_faq);
     $display->output('Support');
     $this->endForm();
 }
 public function actionFaq()
 {
     $this->setLayout('faq');
     $pageModel = StaticPages::model()->byPageId(StaticPages::FAQ)->find();
     $models = Faq::model()->findAll();
     $this->pageTitle .= ' - ' . $pageModel->getTitle();
     $this->breadcrumbs = array('Головна' => $this->createUrl('site/index'), $pageModel->getTitle());
     $this->render('faq', array('pageModel' => $pageModel, 'models' => $models, 'formConsultation' => new ConsultationForm()));
 }
 public function store()
 {
     $input = Input::only('question', 'answer');
     if ($input['question'] != null) {
         $faq = Faq::create($input);
         return $faq;
     } else {
         App::abort(500, 'Question was not saved');
     }
 }
Exemple #19
0
 function __construct()
 {
     if (!in_array(Funcs::$uri[2], $this->getFuncs(__CLASS__))) {
         $tree = Tree::getTreeByUrl('wide');
         Funcs::setMeta($tree);
         $tree['list'] = Faq::getList($tree['id']);
         View::render('cards/index', $tree);
     } elseif (!$_SESSION['iuser']) {
         View::render('site/redirect', array('text' => 'Доступ запрещен', 'href' => '/services/cards/'));
     }
 }
 public function actionHide()
 {
     $id = $this->iGet('id');
     $model = Faq::model()->findByPk($id);
     if ($model === null) {
         $this->redirect(Yii::app()->request->urlReferrer);
     }
     $model->formatDate();
     $model->status = Faq::STATUS_HIDE;
     $model->save();
     Yii::app()->user->setFlash('success', '隐藏FAQ成功');
     $this->redirect(Yii::app()->request->urlReferrer);
 }
Exemple #21
0
 function draw()
 {
     global $display;
     $this->beginForm(true, "post", false, "?" . htmlentities($_SERVER['QUERY_STRING']));
     $id = intval(trim(Url::get('id', 0)));
     if (!empty($id)) {
         $faq = Faq::get_faq($id);
         $display->add('faq', $faq);
     }
     $error_message = $this->getErrorMessage('admin/faq/error');
     $display->add('error_message', $error_message);
     $display->output('Edit');
     $this->endForm();
 }
Exemple #22
0
    public function getRecurs($parent)
    {
        $data = array('sub' => array(), 'count' => 0);
        $sql = '
			SELECT * FROM {{tree}}
			WHERE parent=' . $parent . ' AND visible=1 AND menu=0
			ORDER BY num
		';
        $list = DB::getAll($sql);
        foreach ($list as $item) {
            $items = Faq::getRecurs($item['id']);
            $path = Tree::getPathToTree($item['id']);
            $data['sub'][] = array('name' => $item['name'], 'path' => $path, 'sub' => $items['sub'], 'count' => $countAll);
        }
        $data['count'] = $countAll;
        return $data;
    }
Exemple #23
0
 function __construct()
 {
     if (!in_array(Funcs::$uri[1], get_class_methods(__CLASS__))) {
         $tree = Tree::getTreeByUrl('wide');
         Funcs::setMeta($tree);
         $tree['list'] = Faq::getList($tree['id']);
         if ($_POST) {
             $error = Faq::ask($tree['id']);
             if ($error) {
                 View::render('faq/list', $tree);
             } else {
                 $this->redirect('/help/faq/');
             }
         } else {
             View::render('faq/list', $tree);
         }
     }
 }
Exemple #24
0
/**
 * faq_edit 
 * 
 * @param string $id unique identifier for te FAQ
 *
 * @access public
 * @return string
 */
function faq_edit($id)
{
    $data = array();
    $faq = Faq::fetch($id);
    if (!$faq) {
        throw new NotFoundException();
    }
    if (is_post()) {
        $faq->fromArray($_POST);
        if ($faq->isValid()) {
            $faq->save();
            return redirect('/faq/list');
        } else {
            $data['errors'] = array();
            $data['errors']['faq'] = format_error($faq);
        }
    }
    $data['faq'] = $faq;
    return render('faq_form.tpl', $data);
}
Exemple #25
0
 public function __construct()
 {
     // Construct any possible parent;
     parent::__construct();
     // Do the tie ...
     $this->tieInCommonConfiguration();
     // Set the proper configuration options, from the config file;
     self::$objFaqTable = $this->getConfigKey(new S('faq_table'));
     self::$objFaqTableFId = $this->getConfigKey(new S('faq_table_field_id'));
     self::$objFaqTableFQuestion = $this->getConfigKey(new S('faq_table_field_question'));
     self::$objFaqTableFSEO = $this->getConfigKey(new S('faq_table_field_seo'));
     self::$objFaqTableFAnswer = $this->getConfigKey(new S('faq_table_field_answer'));
     // Load'em defaults ... ATH, STG and others ...
     $this->ATH = MOD::activateModule(new FilePath('mod/authentication'), new B(TRUE));
     $this->STG = MOD::activateModule(new FilePath('mod/settings'), new B(TRUE));
     // DB: Auto-CREATE:
     $objQueryDB = new FileContent($this->getPathToModule()->toRelativePath() . _S . CFG_DIR . _S . __CLASS__ . SCH_EXTENSION);
     // Make a FOREACH on each ...
     foreach (_S($objQueryDB->toString())->fromStringToArray(RA_SCHEMA_HASH_TAG) as $k => $v) {
         // Make'em ...
         $this->_Q(_S($v));
     }
 }
Exemple #26
0
 public function manage_view($limit = 30)
 {
     $message = '';
     if (\Request::has('remove_id')) {
         $faq = Faq::find(\Request::get('remove_id'));
         $faq->delete();
         $message = 'Complete!';
         $faqs = Faq::orderBy('id', 'ASC')->get();
         \Cahen::align($faqs, 'sort');
     } else {
         if (\Request::has('_token')) {
             if (\Request::has(['question', 'answer'])) {
                 $faq = Faq::firstOrNew(['id' => \Request::get('id')]);
                 $faq->question = \Request::get('question');
                 $faq->answer = \Request::get('answer');
                 $faq->tags = explode(',', \Request::get('tags'));
                 $faq->draft_flag = \Request::has('draft_flag');
                 $faq->save();
                 \Cahen::move($faq)->to('sort', \Request::get('sort'));
                 $message = 'Complete!';
                 \Request::merge(['question' => '', 'answer' => '', 'tags' => '', 'sort' => '', 'draft_flag' => '', 'id' => '']);
             } else {
                 $message = '[Error] Question and Answer are required.';
             }
         } else {
             if (\Request::has('id')) {
                 $faq = Faq::find(\Request::get('id'));
                 \Request::merge(['question' => $faq->question, 'answer' => $faq->raw_answer, 'tags' => implode(',', $faq->tags), 'sort' => $faq->sort_number, 'draft_flag' => $faq->draft_flag]);
             }
         }
     }
     $faqs = Faq::orderBy('sort', 'ASC')->paginate($limit);
     $sort_values = Faq::sortSelectValues();
     $tag_values = Faq::tagValues();
     return view('maven::manage', ['faqs' => $faqs, 'sort_values' => $sort_values, 'tag_values' => $tag_values, 'message' => $message])->render();
 }
Exemple #27
0
<?php

require_once './classes/Faq.php';
$faq = new Faq();
$data = $_POST['data'];
$list = $faq->save_page_changes($data);
echo $list;
Exemple #28
0
 /**
  * Get total faq count.
  *
  * @param bool $all
  *
  * @return mixed
  */
 protected function totalFaqs()
 {
     return $this->faq->where('lang', $this->getLang())->count();
 }
Exemple #29
0
     httpResponse($rules->delete($params[1]));
     break;
 case validateRoute('GET', 'faq'):
     $faq = new Faq($db, $user);
     httpResponse($faq->query());
     break;
 case validateRoute('POST', 'faq'):
     $faq = new Faq($db, $user);
     httpResponse($faq->create($postdata));
     break;
 case validateRoute('PATCH', 'faq/\\d+'):
     $faq = new Faq($db, $user);
     httpResponse($faq->update($params[1], $postdata));
     break;
 case validateRoute('DELETE', 'faq/\\d+'):
     $faq = new Faq($db, $user);
     httpResponse($faq->delete($params[1]));
     break;
 case validateRoute('GET', 'polls'):
     $polls = new Polls($db, $user);
     httpResponse($polls->query());
     break;
 case validateRoute('GET', 'polls/latest'):
     $polls = new Polls($db, $user);
     httpResponse($polls->getLatest());
     break;
 case validateRoute('POST', 'polls/votes/\\d+'):
     $polls = new Polls($db, $user);
     httpResponse($polls->vote($params[2], (int) $postdata["choise"]));
     break;
 case validateRoute('POST', 'polls'):
Exemple #30
0
<?php

require_once './classes/Faq.php';
$faq = new Faq();
$list = $faq->get_edit_page();
echo $list;