public function newQuestion()
 {
     // POST İLE GÖNDERİLEN DEĞERLERİ ALALIM.
     $postData = Input::all();
     // FORM KONTROLLERİNİ BELİRLEYELİM
     $rules = array('title' => 'required|between:3,256', 'content' => 'required');
     // HATA MESAJLARINI OLUŞTURALIM
     $messages = array('title.required' => 'Lütfen sorunuzun başlığını yazın', 'title.between' => 'Soru başlığı minumum 3 maksimum 256 karakterden oluşabilir', 'content.required' => 'Lütfen sorunuza ait detayları yazın');
     // KONTROL (VALIDATION) İŞLEMİNİ GERÇEKLEŞTİRELİM
     $validator = Validator::make($postData, $rules, $messages);
     // EĞER VALİDASYON BAŞARISIZ OLURSA HATALARI GÖSTERELİM
     if ($validator->fails()) {
         // HATA MESAJLARI VE INPUT DEĞERLERİYLE FORMA  YÖNLENDİRELİM
         return Redirect::route('newQuestionForm')->withInput()->withErrors($validator->messages());
     } else {
         // SORUYU VERİTABANINA EKLEYELİM
         $question = new Questions();
         $question->user_id = Auth::user()->id;
         $question->title = e(trim($postData['title']));
         $question->content = e(trim($postData['content']));
         $question->created_at = date('Y-m-d H:i:s');
         $question->created_ip = Request::getClientIp();
         $question->save();
         // KULLANICIYI SORULARIN LİSTELENDİĞİ SAYFAYA YÖNLENDİRELİM
         return Redirect::route('allQuestions');
     }
 }
Example #2
0
 public function action_edit($id = null)
 {
     $student = Model_Student::find('first', ['where' => ['user_id' => $id]]);
     if (!$student) {
         $student = Model_Student::forge(['user_id' => $id]);
     }
     $val = Model_Student::validate('edit');
     if ($val->run()) {
         $student->user_id = Input::post('user_id');
         $student->year_level = Input::post('year_level');
         $student->course_id = Input::post('course_id');
         if ($student->save()) {
             Session::set_flash('success', e('Updated student #' . $id));
             Response::redirect('site/student');
         } else {
             Session::set_flash('error', e('Could not update student #' . $id));
         }
     } else {
         if (Input::method() == 'POST') {
             $student->user_id = $val->validated('user_id');
             $student->year_level = $val->validated('year_level');
             $student->course_id = $val->validated('course_id');
             Session::set_flash('error', $val->error());
         }
         $this->template->set_global('student', $student, false);
     }
     $this->template->title = "Students";
     $this->template->content = View::forge('site/student/edit');
 }
Example #3
0
 public function save()
 {
     if (!is_null($this->id)) {
         $sql = "UPDATE campaign_choices SET ";
     } else {
         $sql = "INSERT INTO campaign_choices SET ";
     }
     if (!is_null($this->choice)) {
         $sql .= "choice = \"" . e($this->choice) . "\", ";
     }
     if (!is_null($this->campaign)) {
         $sql .= "campaign_id = \"" . e($this->campaign) . "\", ";
     }
     $sql .= "parent = \"";
     if (!is_null($this->parent)) {
         $sql .= e($this->parent);
     } else {
         $sql .= '0';
     }
     $sql .= "\", ";
     if (!is_null($this->id)) {
         $sql .= 'id="' . e($this->id) . '" where id="' . $this->id . '"';
     } else {
         $sql = trim($sql, ', ');
     }
     Database::singleton()->query($sql);
     if (is_null($this->id)) {
         $this->id = Database::singleton()->lastInsertedID();
     }
 }
Example #4
0
function showOption($option, $title)
{
    ?>
<input type="checkbox" name="<?php 
    echo $option;
    ?>
" value="1" id="<?php 
    echo $option;
    ?>
" <?php 
    if (get_option('surveys_' . $option)) {
        print " checked='checked'";
    }
    ?>
 />
<label for="<?php 
    echo $option;
    ?>
"><?php 
    e($title);
    ?>
</label><br />

<?php 
}
 public function actualizarMisionVision()
 {
     $response = 0;
     $id_centro = e(Input::get('id_centro'));
     $mision_centro = e(Input::get('mision_centro'));
     $vision_centro = e(Input::get('vision_centro'));
     $quienes_somos_centro = e(Input::get('quienes_somos_centro'));
     $centro = Centro::buscar_centro($id_centro);
     if (!is_null(Input::file('img_centro'))) {
         $file_img_vieja = $centro->img_centro;
         $file_img_centro = Input::file('img_centro');
         $img_centro = $file_img_centro->getClientOriginalName();
     } else {
         $img_centro = $centro->img_centro;
     }
     $response = Centro::actualizar_centro_mision_vision_quienes($id_centro, $mision_centro, $vision_centro, $quienes_somos_centro, $img_centro);
     if ($response == 1) {
         if (!is_null(Input::file('img_centro'))) {
             $file_img_centro->move('img', $file_img_centro->getClientOriginalName());
             File::delete('img/' . $file_img_vieja);
         }
         return Redirect::to(URL::previous())->with('mensaje', 'Centro de Investigacion Actualizado Insertado Correctamente');
     } else {
         return Redirect::to(URL::previous())->with('mensaje', 'Ha ocurrido un error');
     }
 }
Example #6
0
 public function save()
 {
     if (isset($this->id) && $this->id != "") {
         if ($save = $this->sql->prepare("UPDATE wolfvtc_menu SET (name=?, url=?, weight=?) WHERE id=?")) {
             // update info
             $save->bind_param("ssii", e($this->name), e($this->url), intval($this->weight), intval($this->id));
             if ($save->execute) {
                 return TRUE;
             } else {
                 return FALSE;
             }
         } else {
             return FALSE;
         }
     } else {
         if ($save = $this->sql->prepare("INSERT INTO wolfvtc_menu (name, url, weight) VALUES (?, ?, ?)")) {
             // add new link
             $save->bind_param("ss", e($this->name), e($this->url), intval($this->weight));
             if ($save->execute) {
                 return TRUE;
             } else {
                 return FALSE;
             }
         } else {
             return FALSE;
         }
     }
 }
Example #7
0
 function render()
 {
     $json = json_encode($this->obj);
     $html =& Dispatcher::loadHelper('html');
     $html->headerNoCache();
     e($json);
 }
 /**
  * @return array
  * @throws Exception
  */
 public function rules()
 {
     $what = Input::get('what');
     $rules = ['description' => 'required|min:1,max:255', 'what' => 'required|in:withdrawal,deposit,transfer', 'amount' => 'numeric|required|min:0.01', 'date' => 'required|date', 'process_date' => 'date', 'book_date' => 'date', 'interest_date' => 'date', 'category' => 'between:1,255', 'amount_currency_id_amount' => 'required|exists:transaction_currencies,id', 'piggy_bank_id' => 'numeric', 'due_date' => 'date', 'payment_date' => 'date', 'internal_reference' => 'min:1,max:255', 'notes' => 'min:1,max:65536'];
     switch ($what) {
         case strtolower(TransactionType::WITHDRAWAL):
             $rules['source_account_id'] = 'required|exists:accounts,id|belongsToUser:accounts';
             $rules['destination_account_name'] = 'between:1,255';
             if (intval(Input::get('budget_id')) != 0) {
                 $rules['budget_id'] = 'exists:budgets,id|belongsToUser:budgets';
             }
             break;
         case strtolower(TransactionType::DEPOSIT):
             $rules['source_account_name'] = 'between:1,255';
             $rules['destination_account_id'] = 'required|exists:accounts,id|belongsToUser:accounts';
             break;
         case strtolower(TransactionType::TRANSFER):
             $rules['source_account_id'] = 'required|exists:accounts,id|belongsToUser:accounts|different:destination_account_id';
             $rules['destination_account_id'] = 'required|exists:accounts,id|belongsToUser:accounts|different:source_account_id';
             break;
         default:
             throw new FireflyException('Cannot handle transaction type of type ' . e($what) . '.');
     }
     return $rules;
 }
Example #9
0
 public function getNote()
 {
     $Parsedown = new Parsedown();
     if ($this->note) {
         return $Parsedown->text(e($this->note));
     }
 }
Example #10
0
 /**
  * Построение ссылки
  *
  * @param	string	$url
  * @param	boolean	$absolute_flag
  * @param	string	$protocol
  * @return	string
  */
 public static function link($url = '', $absolute_flag = FALSE, $protocol = 'http')
 {
     $link = '';
     $cogear = getInstance();
     if (!$url) {
         return $protocol . '://' . SITE_URL . '/';
     } else {
         if (TRUE === $url) {
             return l() . cogear()->router->getUri();
         }
     }
     $url = parse_url($url);
     if ($absolute_flag) {
         $link .= $protocol . '://';
         $link .= SITE_URL;
     } elseif (defined('FOLDER')) {
         $link .= '/' . FOLDER;
     }
     isset($url['host']) && ($link = $protocol . '://' . $url['host']);
     isset($url['path']) && ($link .= '/' . ltrim($url['path'], '/'));
     isset($url['query']) && ($link .= '?' . $url['query']);
     isset($url['fragment']) && ($link .= '#' . $url['fragment']);
     event('link', $link);
     if (cogear()->input->get('splash') === '') {
         $link .= e();
     }
     return $link;
 }
 /**
  * @return string
  */
 public function getIcon()
 {
     if (!isset($this->icon)) {
         return;
     }
     return '<i class="fa fa-' . e($this->icon) . ' menu-icon"></i>';
 }
function h($value, $number = 1)
{
    if ($number < 0 || $number > 6) {
        $number = 1;
    }
    e($value, 'h' . $number, array('class' => 'heading-' . $number));
}
Example #13
0
 static function check($res)
 {
     if ($res->errcode != 0) {
         Log . e("FAIL: " . json_encode($res));
         exit("Failed: " . json_encode($res));
     }
 }
Example #14
0
 /**
  * Render the notifications' script tag
  *
  * @return string
  * @internal param bool $flashed Whether to get the
  *
  */
 public function render()
 {
     $notifications = $this->session->get('toastr::notifications');
     if (!$notifications) {
         $notifications = [];
     }
     $output = '<script type="text/javascript">';
     $lastConfig = [];
     foreach ($notifications as $notification) {
         $config = $this->config->get('toastr.options');
         if (count($notification['options']) > 0) {
             // Merge user supplied options with default options
             $config = array_merge($config, $notification['options']);
         }
         // Config persists between toasts
         if ($config != $lastConfig) {
             $output .= 'toastr.options = ' . json_encode($config) . ';';
             $lastConfig = $config;
         }
         // Toastr output
         $output .= 'toastr.' . $notification['type'] . "('" . str_replace("'", "\\'", str_replace(['&lt;', '&gt;'], ['<', '>'], e($notification['message']))) . "'" . (isset($notification['title']) ? ", '" . str_replace("'", "\\'", htmlentities($notification['title'])) . "'" : null) . ');';
     }
     $output .= '</script>';
     return $output;
 }
    public function render($__data)
    {
        ?>
<ul>
    <?php 
        foreach ($this->variable($__data, 'messages.success', [], '', [], 'traversable') as $i => $messagesSuccessItem) {
            ?>
    <li><?php 
            echo e($this->variable($messagesSuccessItem, 'message', [], '', null, 'string'));
            ?>
</li>
    <?php 
        }
        ?>
</ul>
<ul>
    <?php 
        foreach ($this->variable($__data, 'messages.error', [], '', [], 'traversable') as $i => $messagesErrorItem) {
            ?>
    <li><?php 
            echo e($this->variable($messagesErrorItem, 'message', [], '', null, 'string'));
            ?>
</li>
    <?php 
        }
        ?>
</ul><?php 
    }
Example #16
0
 public function action_login()
 {
     // Already logged in
     Auth::check() and Response::redirect('admin');
     $val = Validation::forge();
     if (Input::method() == 'POST') {
         $val->add('email', 'ユーザ名')->add_rule('required');
         $val->add('password', 'パスワード')->add_rule('required');
         if ($val->run()) {
             $auth = Auth::instance();
             // check the credentials. This assumes that you have the previous table created
             if (Auth::check() or $auth->login(Input::post('email'), Input::post('password'))) {
                 // credentials ok, go right in
                 if (Config::get('auth.driver', 'Simpleauth') == 'Ormauth') {
                     $current_user = Model\Auth_User::find_by_username(Auth::get_screen_name());
                 } else {
                     $current_user = Model_User::find_by_username(Auth::get_screen_name());
                 }
                 Session::set_flash('success', e('ようこそ、' . $current_user->username . 'さん'));
                 Response::redirect('admin');
             } else {
                 $this->template->set_global('login_error', '失敗しました');
             }
         }
     }
     $this->template->title = 'ログイン';
     $this->template->content = View::forge('admin/login', array('val' => $val), false);
 }
 /**
  * @return string
  */
 public function getAddress()
 {
     if ('' === $this->offsetGet(Schema::EMAIL)) {
         e('"email" key is empty in this email account ' . json_encode($this->getArrayCopy()));
     }
     return '';
 }
function confirm_collection_type($type)
{
    global $cbcollection;
    if (empty($type)) {
        $type = 'photos';
    }
    if ($type != $cbcollection->types) {
        if (VERSION < '3.0') {
            // Get Deprecated Types;
            $dep_types = $cbcollection->deprecated_types;
            $message = 'Collections feature now only support photos';
            if (array_key_exists($type, $dep_types)) {
                $message .= '. ' . $cbcollection->deprecated_types[$type] . ' support has been dropped since 2.6';
                $dep_type = $cbcollection->deprecated_types[$type] . ' ';
            }
            if (userid() && has_access('admin_access', true)) {
                $message .= '. Please upgrade your Clipbucket to <a href="http://clip-bucket.com" target="_blank">latest version</a>';
            } else {
                $message .= '. Please contact Site Administrator about this.';
            }
            e(lang($message));
            cb_show_page();
        }
        return $cbcollection->types;
    }
    return $cbcollection->types;
}
Example #19
0
 /**
  * Save handler for CMS Field input
  */
 public function __async_save()
 {
     $response = array('status' => 0);
     // If we have post data
     if (isset($_POST)) {
         // Make pointers to posted parameters
         $entity =& $_POST['__entity'];
         $param =& $_POST['__param'];
         $identifier =& $_POST['__obj_id'];
         $value =& $_POST['__value'];
         // Check if all necessary data is passed
         if (!isset($value)) {
             e('CMSField - no "value" is passed for saving', E_SAMSON_CORE_ERROR);
         }
         if (!isset($entity)) {
             e('CMSField - no "entity" is passed for saving', E_SAMSON_CORE_ERROR);
         }
         if (!isset($identifier)) {
             e('CMSField - no "object identifier" is passed for saving', E_SAMSON_CORE_ERROR);
         }
         if (!isset($param)) {
             e('CMSField - no "object field name" is passed for saving', E_SAMSON_CORE_ERROR);
         }
         // Create new Field instance
         $this->createField(new dbQuery(), $entity, $param, $identifier);
         $response['status'] = 1;
         // Save specified value to SamsonCMS input
         $this->field->save($value, $response);
     }
     return $response;
 }
 public function action_addtask($project_id)
 {
     if (!($project = Model_Project::find($project_id))) {
         \Fuel\Core\Session::set_flash('error', "Cannot find the selected project # {$project_id}");
         \Fuel\Core\Response::redirect_back('user/projects');
     }
     $val = Model_Projecttask::validate('create');
     if (\Fuel\Core\Input::method() == 'POST') {
         if ($val->run()) {
             $projecttask = Model_Projecttask::forge(array('project_id' => Input::post('project_id'), 'user_id' => Input::post('user_id'), 'project_task_name_id' => Input::post('project_task_name_id'), 'hourly_rate' => Input::post('hourly_rate'), 'task_status' => 0, 'task_due' => Input::post('task_due'), 'project_task_description' => Input::post('project_task_description'), 'comment' => Input::post('comment'), 'priority' => Input::post('priority')));
             if ($projecttask and $projecttask->save()) {
                 Session::set_flash('success', e('Added task #' . $projecttask->id . '.'));
                 Response::redirect('user/projects/view/' . $project_id);
             } else {
                 Session::set_flash('error', e('Could not save task.'));
             }
         } else {
             \Fuel\Core\Session::set_flash('error', $val->error());
         }
     }
     $this->load_presenter($project, Model_Projecttask::forge(array('id' => 0, 'project_id' => $project->id, 'user_id' => $this->current_user->id, 'task_status' => 0, 'hourly_rate' => 456, 'task_due' => date('Y-m-d'))));
     $this->template->set_global('project_task_names', Model_Projecttaskname::find('all', array('order_by' => array(array('name', 'asc')))));
     $this->template->set_global('users', array(Model_User::find($this->current_user->id)));
     $this->template->set_global('priorities', THelper::get_priorities());
     $this->template->title = 'My Projects';
     $this->template->content = Fuel\Core\View::forge('user/projects/addtask');
 }
 function rest_index()
 {
     $this->autoRender = false;
     $this->header('Content-Type: application/json');
     $modelClass = $this->modelClass;
     // add any applicable filters
     $conditions = array();
     if (array_key_exists('filter', $this->params['url'])) {
         $filters = json_decode($this->params['url']['filter'], true);
         foreach ($filters as $filter) {
             if (array_key_exists($filter['property'], $this->{$modelClass}->_schema)) {
                 $conditions[$modelClass . '.' . $filter['property']] = $filter['value'];
             }
         }
     }
     $models = $this->{$modelClass}->find('all', array('recursive' => 1, 'conditions' => $conditions, 'limit' => 300, 'order' => 'Answer.created DESC'));
     // custom stuff
     $arr = array();
     foreach ($models as $item) {
         $item['Answer']['choices'] = $item['Choice'];
         $item['Answer']['question'] = $item['Question'];
         $item['Answer']['survey_id'] = $item['Question']['survey_id'];
         $item['Answer']['subject'] = $item['Subject'];
         $arr[] = $item['Answer'];
     }
     e(json_encode($arr));
 }
 /**
  * Setting update form processing page.
  *
  * @param  int  $settingId
  * @return Redirect
  */
 public function postEdit()
 {
     // Check if the asset exists
     if (is_null($setting = Setting::find(1))) {
         // Redirect to the asset management page with error
         return Redirect::to('admin')->with('error', Lang::get('admin/settings/message.update.error'));
     }
     $new = Input::all();
     // Declare the rules for the form validation
     $rules = array("site_name" => 'required|min:3', "per_page" => 'required|min:1|numeric', "qr_text" => 'min:1|max:31');
     // Create a new validator instance from our validation rules
     $validator = Validator::make(Input::all(), $rules);
     // If validation fails, we'll exit the operation now.
     if ($validator->fails()) {
         // Ooops.. something went wrong
         return Redirect::back()->withInput()->withErrors($validator);
     }
     // Update the asset data
     $setting->id = '1';
     $setting->site_name = e(Input::get('site_name'));
     $setting->display_asset_name = e(Input::get('display_asset_name', '0'));
     $setting->per_page = e(Input::get('per_page'));
     $setting->qr_code = e(Input::get('qr_code', '0'));
     $setting->qr_text = e(Input::get('qr_text'));
     // Was the asset updated?
     if ($setting->save()) {
         // Redirect to the settings page
         return Redirect::to("admin/settings/app")->with('success', Lang::get('admin/settings/message.update.success'));
     }
     // Redirect to the setting management page
     return Redirect::to("admin/settings/app/edit")->with('error', Lang::get('admin/settings/message.update.error'));
 }
 /**
  * 创建或更新Meta分类
  *
  * @param  Douyasi\Models\Meta $meta
  * @param  array $inputs
  * @return Douyasi\Models\Meta
  */
 private function saveDynasty($dynasty, $inputs)
 {
     $dynasty->creater = e($inputs['creater']);
     $dynasty->brief = e($inputs['brief']);
     $dynasty->save();
     return $dynasty;
 }
Example #24
0
function beforeSql(array $data)
{
    foreach ($data as $key => $value) {
        $setData[$key] = e($data[$key]);
    }
    return $setData;
}
Example #25
0
 /**
  * Validates and stores the user's update data.
  *
  * @author [A. Gianotto] [<*****@*****.**>]
  * @since [v1.0]
  * @return Redirect
  */
 public function postIndex()
 {
     // Grab the user
     $user = Auth::user();
     // Update the user information
     $user->first_name = e(Input::get('first_name'));
     $user->last_name = e(Input::get('last_name'));
     $user->website = e(Input::get('website'));
     $user->location_id = e(Input::get('location_id'));
     $user->gravatar = e(Input::get('gravatar'));
     $user->locale = e(Input::get('locale'));
     if (Input::file('avatar')) {
         $image = Input::file('avatar');
         $file_name = $user->first_name . "-" . $user->last_name . "." . $image->getClientOriginalExtension();
         $path = public_path('uploads/avatars/' . $file_name);
         Image::make($image->getRealPath())->resize(84, 84)->save($path);
         $user->avatar = $file_name;
     }
     if (Input::get('avatar_delete') == 1 && Input::file('avatar') == "") {
         $user->avatar = null;
     }
     if ($user->save()) {
         return redirect()->route('profile')->with('success', 'Account successfully updated');
     }
     return redirect()->back()->withInput()->withErrors($user->getErrors());
 }
 public function login()
 {
     //Reglas
     $rules = array('iCorreo' => 'required|regex:/^([a-zA-Z0-9])+@espoch.edu.ec/', 'iPassword' => 'required');
     //Mensajes
     $messages = array('required' => 'El campo :attribute es obligatorio', 'correo' => 'El campo :attribute debe ser un email institucional');
     $validation = Validator::make(Input::all(), $rules, $messages);
     if ($validation->fails()) {
         return Redirect::to(URL::previous())->withInput()->withErrors($validation);
     } else {
         $credenciales = array('correo_usuario' => e(Input::get('iCorreo')), 'password' => e(Input::get('iPassword')));
         if (Auth::attempt($credenciales)) {
             $id = Auth::User()->id;
             $user = User::find($id);
             $user->estado_usuario = 1;
             $user->save();
             switch (Auth::User()->tipo_usuario) {
                 case 1:
                     return Redirect::to('/administrador/index');
                     break;
                 case 2:
                     return Redirect::to('/moderador/index');
                     break;
                 case 3:
                     return Redirect::to('/usuarios/index');
                     break;
             }
         } else {
             return Redirect::to(URL::previous())->with('mensaje', 'Credenciales Inválidas');
         }
     }
 }
Example #27
0
 public function action_login()
 {
     // Already logged in
     Auth::check() and Response::redirect('admin');
     $val = Validation::forge();
     if (Input::method() == 'POST') {
         $val->add('email', 'Email or Username')->add_rule('required');
         $val->add('password', 'Password')->add_rule('required');
         if ($val->run()) {
             if (!Auth::check()) {
                 if (Auth::login(Input::post('email'), Input::post('password'))) {
                     // assign the user id that lasted updated this record
                     foreach (\Auth::verified() as $driver) {
                         if (($id = $driver->get_user_id()) !== false) {
                             // credentials ok, go right in
                             $current_user = Model\Auth_User::find($id[1]);
                             Session::set_flash('success', e('Welcome, ' . $current_user->username));
                             Response::redirect_back('admin');
                         }
                     }
                 } else {
                     $this->template->set_global('login_error', 'Login failed!');
                 }
             } else {
                 $this->template->set_global('login_error', 'Already logged in!');
             }
         }
     }
     $this->template->title = 'ITNT Timesheets Login';
     $this->template->content = View::forge('admin/login', array('val' => $val), false);
 }
Example #28
0
 public function convert($body)
 {
     if ($this->options['is_strip_tags']) {
         $allowable_tags = $this->options['allowable_tags'] ?: '';
         if (is_array($allowable_tags)) {
             $allowable_tags = implode('', $allowable_tags);
         }
         $body = strip_tags($body, $allowable_tags);
     }
     $body = e($body);
     if ($this->options['nl2br']) {
         $body = nl2br($body);
     }
     $body = $this->convert_url2link($body);
     $body = $this->convert_mention2link($body);
     $body = $this->truncate($body);
     $data = array();
     if ($this->is_truncated && $this->options['read_more_uri']) {
         $data['read_more_uri'] = $this->options['read_more_uri'];
     }
     $data['display_summary_type'] = $this->options['url2link_display_summary_type'];
     if ($this->url2link_site_summary_url) {
         $data['site_summary_url'] = $this->url2link_site_summary_url;
     }
     if ($this->url2link_site_summary_data) {
         $data['site_summary_data'] = $this->url2link_site_summary_data;
     }
     $view = View::forge('_parts/converted_body', $data);
     $view->set_safe('body', $body);
     return $view->render();
 }
Example #29
0
 function ElemRedactB($row)
 {
     foreach ($row as $k => $v) {
         $row[$k] = e($v);
     }
     return $row;
 }
Example #30
0
 function ItemViewController()
 {
     $layoutVariables = array('surtitre' => 'Réfléchir : ' . $this->item['titreCourt'], 'titre' => $this->item['titreLong'], 'afficherVideo' => true, 'intro' => $this->item['intro'], 'titreCorps' => 'Pistes de réflexion', 'afficherTheme' => true, 'theme' => $this->itemID, 'afficherEtape' => true, 'etape' => 1);
     $this->layout->AddVariables($layoutVariables);
     // Charger le module lexique
     $lexique = $this->NestModule('lexique');
     // Loader les items
     $queryParams = array('fields' => 'terme', 'orderby' => "LENGTH(terme) DESC");
     $lexique->FetchItems($queryParams);
     // Identifier les mots du lexique
     if ($lexique->items && $this->item['questions']) {
         $replace = array();
         foreach ($lexique->items as $id => $item) {
             $pattern = '/(' . $item['terme'] . ')(?![\\d\\w])/i';
             preg_match_all($pattern, $this->item['questions'], $matches);
             $replace[$item['id']] = $matches[0];
             // Replace matches with placeholders
             $this->item['questions'] = preg_replace($pattern, '%PLACEHOLDER' . $item['id'], $this->item['questions']);
         }
         foreach ($replace as $id => $array) {
             // Remplacer les placeholders par les termes
             while ($string = array_shift($array)) {
                 $tag = e('span', array('class' => 'definir definition' . $id), $string);
                 $this->item['questions'] = preg_replace('/%PLACEHOLDER' . $id . '(?![\\d\\w])/', $tag, $this->item['questions'], 1);
             }
             // Définir la liste des définitions qu'on doit afficher
             $this->view['listeTermes'][$id] = $id;
         }
     }
 }