Example #1
0
    public function table($data)
    {
        if (is_array($data) || is_object($data)) {
            $output = '<table class="table table-striped">
						<tbody>';
            foreach ((array) $data as $key => $value) {
                $output .= '		<tr>
										<td style="width: 200px;"><b>' . $key . '</b></td>
										<td>' . $this->table($value) . '</td>
									</tr>';
            }
            $output .= '		</tbody>
							</table>';
            return $output;
        } else {
            if (is_bool($data)) {
                return $data ? '<i class="fa fa-check text-success" title="TRUE"></i>' : '<i class="fa fa-close text-danger" title="FALSE"></i>';
            } else {
                if (is_null($data)) {
                    return '<em>NULL</em>';
                } else {
                    return utf8_htmlentities(str_replace(array("\n", "\r"), '', $data));
                }
            }
        }
    }
Example #2
0
function wrsqz_printSuccess($success){
	if($success) {
		echo '<font color="green" >'.utf8_htmlentities(translate('OK')). '</font>';
	} else {
		echo '<font color="red" >'.utf8_htmlentities(translate('FAIL')).'</font>';
	}
	return $success;
}
Example #3
0
 public function index($settings = array())
 {
     $links = array();
     foreach ($settings as $key => $values) {
         if (in_array($key, array('title', 'url'))) {
             foreach ($values as $i => $value) {
                 $links[$i][$key] = utf8_htmlentities($value);
             }
         }
     }
     return array('links' => $links, 'display' => (bool) $settings['display']);
 }
Example #4
0
 public function install($dispositions = array())
 {
     $this->config('default_background_repeat', 'no-repeat')->config('default_background_attachment', 'scroll')->config('default_background_position', 'center top')->config('default_background_color', '#141d26');
     $dispositions['*']['{lang content}'] = array(new Row(new Col(new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', array('widget' => 'breadcrumb', 'type' => 'index')))), 'col-md-12'), 'row-white'), new Row(new Col(new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', array('widget' => 'module', 'type' => 'index')))), 'col-md-8'), new Col(new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', array('widget' => 'members', 'type' => 'online')), 'style' => 'panel-red')), new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', array('widget' => 'user', 'type' => 'index')), 'style' => 'panel-dark')), new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', array('widget' => 'news', 'type' => 'categories')), 'style' => 'panel-default')), new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', array('widget' => 'talks', 'type' => 'index', 'settings' => serialize(array('talk_id' => 2)))), 'style' => 'panel-default')), 'col-md-4'), 'row-light'));
     $dispositions['*']['{lang pre_content}'] = array(new Row(new Col(new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', array('widget' => 'forum', 'type' => 'topics')), 'style' => 'panel-default')), 'col-md-4'), new Col(new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', array('widget' => 'news', 'type' => 'index')), 'style' => 'panel-dark')), 'col-md-4'), new Col(new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', array('widget' => 'members', 'type' => 'index')), 'style' => 'panel-red')), 'col-md-4'), 'row-default'));
     $dispositions['*']['{lang post_content}'] = array();
     $dispositions['*']['{lang header}'] = array(new Row(new Col(new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', array('widget' => 'header', 'type' => 'index', 'settings' => serialize(array('align' => 'text-center', 'title' => '', 'description' => '', 'color-title' => '', 'color-description' => '#DC351E')))))), 'col-md-12'), 'row-default'), new Row(new Col(new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', $navigation = array('widget' => 'navigation', 'type' => 'index', 'settings' => serialize(array('display' => TRUE, 'links' => array(array('title' => utf8_htmlentities($this('home')), 'url' => 'index.html'), array('title' => utf8_htmlentities($this('news')), 'url' => 'news.html'), array('title' => utf8_htmlentities($this('forum')), 'url' => 'forum.html'), array('title' => utf8_htmlentities($this('teams')), 'url' => 'teams.html'), array('title' => utf8_htmlentities($this('members')), 'url' => 'members.html'), array('title' => utf8_htmlentities($this('contact')), 'url' => 'contact.html')))))))), 'col-md-8'), new Col(new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', array('widget' => 'user', 'type' => 'index_mini')))), 'col-md-4'), 'row-black'));
     $dispositions['*']['{lang top}'] = array(new Row(new Col(new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', array('widget' => 'navigation', 'type' => 'index', 'settings' => serialize(array('display' => TRUE, 'links' => array(array('title' => 'Facebook', 'url' => '#'), array('title' => 'Twitter', 'url' => '#'), array('title' => 'Origin', 'url' => '#'), array('title' => 'Steam', 'url' => '#')))))))), 'col-md-8'), new Col(new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', array('widget' => 'members', 'type' => 'online_mini')))), 'col-md-4'), 'row-default'));
     $dispositions['*']['{lang footer}'] = array(new Row(new Col(new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', array('widget' => 'html', 'type' => 'index', 'settings' => serialize(array('content' => utf8_htmlentities($this('powered_by_neofrag')))))), 'style' => 'panel-dark'))), 'row-default'));
     $dispositions['/']['{lang header}'] = array(new Row(new Col(new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', array('widget' => 'header', 'type' => 'index', 'settings' => serialize(array('align' => 'text-center', 'title' => '', 'description' => '', 'color-title' => '', 'color-description' => '#DC351E')))))), 'col-md-12'), 'row-default'), new Row(new Col(new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', $navigation))), 'col-md-8'), new Col(new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', array('widget' => 'user', 'type' => 'index_mini')))), 'col-md-4'), 'row-black'), new Row(new Col(new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', array('widget' => 'slider', 'type' => 'index')))), 'col-md-12'), 'row-default'));
     foreach (array('forum/*', 'news/_news/*', 'user/*') as $page) {
         $dispositions[$page]['{lang content}'] = array(new Row(new Col(new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', array('widget' => 'breadcrumb', 'type' => 'index')))), 'col-md-12'), 'row-white'), new Row(new Col(new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', array('widget' => 'module', 'type' => 'index')))), 'col-md-12'), 'row-light'));
     }
     $dispositions['forum/*']['{lang post_content}'] = array(new Row(new Col(new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', array('widget' => 'forum', 'type' => 'statistics')), 'style' => 'panel-red')), 'col-md-4'), new Col(new Widget_View(array('widget_id' => $this->db->insert('nf_widgets', array('widget' => 'forum', 'type' => 'activity')), 'style' => 'panel-dark')), 'col-md-8'), 'row-light'));
     return parent::install($dispositions);
 }
Example #5
0
	echo utf8_htmlentities(translate('Please choose the actions to be performed:'));
	echo '<br />';
	echo '<form action=./uninstall.php method="POST">';
	echo '<input type="hidden" name="step" value="3" />';
	echo '<ul><li>';
	echo '<input type="checkbox" name="uninstall" value="true" checked="true" /> '.utf8_htmlentities(translate('Uninstall WIRIS Quizzes.'));
	echo '</li><li>';
	echo '<input type="checkbox" name="deletefiles" value="true"/> '.utf8_htmlentities(translate('Delete WIRIS Quizzes files.'));
	echo '</li><li>';
	echo '<input type="checkbox" name="deletetables" value="true"/> '.utf8_htmlentities(translate('Delete WIRIS Quizzes tables in site database.'));
	echo '</li></ul>';
	echo '<div align="center">';
	echo '<input type="submit" value="Continue" />';
	echo '</div>';
	echo '</form>';
	echo '</div>';
	echo '<br /><br />';
	echo '<div id="information">';
	echo utf8_htmlentities(translate('If you check...'));
	echo '<ul><li>';
	echo '<i>'.utf8_htmlentities(translate('Uninstall WIRIS Quizzes.')).'</i>: '.utf8_htmlentities(translate('Moodle files patched during the installation will be restored, WIRIS Quizzes question type files will be deleted and WIRIS Quizzes language files will be deleted too. The system will be ready for another clean installation of WIRIS Quizzes'));
	echo '</li><li>';
	echo '<i>'.utf8_htmlentities(translate('Delete WIRIS Quizzes files.')).'</i>: '.utf8_htmlentities(translate('WIRIS Quizzes files (including installation ones) will be permanently deleted.')); 
	echo '</li><li>';
	echo '<i>' . utf8_htmlentities(translate('Delete WIRIS Quizzes tables in site database.')) . '</i>: ' . utf8_htmlentities(translate('WIRIS Quizzes database entries will be removed. You will loose all WIRIS Quizzes data created.'));
	echo '</li></ul>';
	
} else {
	redirect($CFG->wwwroot);
}
?>
Example #6
0
<?php

if (!defined('SECURITY_CONSTANT')) {
    exit;
}
if (parseConfig() == NO_WRITE_PERMISION) {
    echo utf8_htmlentities(translate('WIRIS Quizzes installer hasn\'t write permisions on')), ' ./wrsqz_config.php <br />';
    echo '<ul><li>', utf8_htmlentities(translate('Copy the following PHP file and paste to')), ' <b>wiris-quizzes/wrsqz_config.php</b>', '</li></ul>';
    echo '<div id="information">';
    echo str_replace("\n", "<br />", utf8_htmlentities(parseConfig(true)));
    echo '</div>';
    echo '<br />';
    echo '<form action="./install.php" method="POST">';
    echo '<input type="hidden" name="language" value="', utf8_htmlentities($shortLanguageName), '" />';
    echo '<input type="hidden" name="step" value="5">';
    echo '<input type="submit" value="Continue" />';
    echo '</form>';
    echo '<br /><br /><hr>';
    echo errorMessage('conf');
} else {
    echo '<div align="left"><br /><ul><li><i>wrsqz_config.php</i> ', utf8_htmlentities(translate('successfully created.')), '</li></ul></div>';
    include './install/pages/5.php';
}
Example #7
0
		<div id="center">
		<?php 
if (!defined('SECURITY_CONSTANT')) {
    exit;
}
if (is_dir('../pluginwiris')) {
    include '../pluginwiris/wrs_config.php';
    if (checkVersion($CFG->wirisversion, '2.1.25')) {
        $toInclude = './install/pages/';
        if (isset($_POST['step'])) {
            $toInclude .= basename($_POST['step']) . '.php';
        } else {
            if (isset($_GET['db'])) {
                $toInclude .= 'db.php';
            }
        }
        if (is_file($toInclude)) {
            include $toInclude;
        } else {
            include './install/pages/0.php';
        }
    } else {
        echo utf8_htmlentities(translate('WIRIS Quizzes requires Plugin WIRIS 2.1.25 or greater. Your current Plugin WIRIS version is ') . $CFG->wirisversion . translate('. You can install it from')) . ' <a href="http://www.wiris.com/component/option,com_wrapper/Itemid,92/lang,es/">' . utf8_htmlentities(translate('here')) . '</a>.';
    }
} else {
    echo utf8_htmlentities(translate('You must install Plugin WIRIS before install WIRIS Quizzes. You can install it from')) . ' <a href="http://www.wiris.com/component/option,com_wrapper/Itemid,92/lang,es/">' . utf8_htmlentities(translate('here')) . '</a>.';
}
?>
		</div>
Example #8
0
<?php
if (!defined('SECURITY_CONSTANT')) exit;

echo '<form action="./uninstall.php" method="POST">';					
echo '<input type="hidden" name="step" value="2" />';
echo '<input type="hidden" name="language" value="', utf8_htmlentities($shortLanguageName), '" />';

echo utf8_htmlentities(translate('Are you absolutely sure to uninstall WIRIS quizzes?')), '<br /><br />';
echo '<input type="submit" name="option" value="', utf8_htmlentities(translate('Yes')), '" /> <input type="submit" name="option" value="', utf8_htmlentities(translate('No')), '" /></p>';
echo '</form>';
echo '<div id="information">';
echo 'If you click yes...';
echo '<ul><li>'.utf8_htmlentities(translate('All questions and quizzes in your site which use WIRIS Quizzes features will stop working.')).' </li>';
echo '<li>'.utf8_htmlentities(translate('All questions and quizzes such that don\'t use any WIRIS Quizzes feature will still work.')).' </li></ul>';
echo '</div>';
?>
Example #9
0
 public function _sessions($sessions)
 {
     $this->title($this('sessions'))->subtitle($this('list_active_sessions'))->icon('fa-globe')->load->library('table')->preprocessing(function ($row) {
         $user_data = unserialize($row['user_data']);
         $row['date'] = $user_data['session']['date'];
         $row['history'] = array_reverse($user_data['session']['history']);
         $row['user_agent'] = $user_data['session']['user_agent'];
         $row['referer'] = $user_data['session']['referer'];
         unset($row['user_data']);
         return $row;
     })->add_columns(array(array('content' => function ($data) {
         return $data['remember_me'] ? '<i class="fa fa-toggle-on text-green" data-toggle="tooltip" title="Connexion persistante"></i>' : '<i class="fa fa-toggle-off text-grey" data-toggle="tooltip" title="Connexion non persistante"></i>';
     }, 'size' => TRUE, 'align' => 'center'), array('title' => $this('user'), 'content' => function ($data, $loader) {
         return $data['user_id'] ? NeoFrag::loader()->user->link($data['user_id'], $data['username']) : '<i>' . $loader->lang('guest') . '</i>';
     }, 'search' => function ($data, $loader) {
         return $data['user_id'] ? $data['username'] : $loader->lang('guest');
     }, 'sort' => function ($data, $loader) {
         return $data['user_id'] ? $data['username'] : $loader->lang('guest');
     }), array('content' => function ($data) {
         return user_agent($data['user_agent']);
     }, 'size' => TRUE, 'align' => 'center', 'search' => function ($data) {
         return $data['user_agent'];
     }, 'sort' => function ($data) {
         return $data['user_agent'];
     }), array('title' => $this('ip_address'), 'content' => function ($data) {
         return geolocalisation($data['ip_address']) . '<span data-toggle="tooltip" data-original-title="' . $data['host_name'] . '">' . $data['ip_address'] . '</span>';
     }, 'search' => function ($data) {
         return $data['ip_address'];
     }, 'sort' => function ($data) {
         return $data['ip_address'];
     }), array('title' => $this('referer'), 'content' => function ($data, $loader) {
         return $data['referer'] ? urltolink($data['referer']) : $loader->lang('none');
     }, 'search' => function ($data) {
         return $data['user_agent'];
     }, 'sort' => function ($data) {
         return $data['user_agent'];
     }), array('title' => $this('arrival_date'), 'content' => function ($data) {
         return '<span data-toggle="tooltip" title="' . timetostr(NeoFrag::loader()->lang('date_time_long'), $data['date']) . '">' . time_span($data['date']) . '</span>';
     }, 'sort' => function ($data) {
         return $data['date'];
     }), array('title' => $this('last_activity'), 'content' => function ($data) {
         return '<span data-toggle="tooltip" title="' . timetostr(NeoFrag::loader()->lang('date_time_long'), $data['last_activity']) . '">' . time_span($data['last_activity']) . '</span>';
     }, 'sort' => function ($data) {
         return $data['last_activity'];
     }), array('title' => $this('history'), 'content' => function ($data, $loader) {
         $links = implode('<br />', array_map(function ($a) {
             return '<a href="' . url($a) . '">' . $a . '</a>';
         }, $data['history']));
         return '<span data-toggle="popover" title="' . $loader->lang('last_pages_visited') . '" data-content="' . utf8_htmlentities($links) . '" data-placement="auto" data-html="1">' . icon('fa-history') . ' ' . reset($data['history']) . '</span>';
     }), array('content' => array(function ($data) {
         if ($data['user_id'] && $data['session_id'] != NeoFrag::loader()->session('session_id')) {
             return button_delete('admin/members/sessions/delete/' . $data['session_id'] . '.html');
         }
     }))))->data($sessions);
     return new Panel(array('title' => $this('sessions'), 'icon' => 'fa-globe', 'content' => $this->table->display()));
 }
Example #10
0
 public function index($search = '', $module_name = '', $page = '')
 {
     $this->title('Rechercher');
     $this->load->library('form')->add_rules(array('keywords' => array('type' => 'text', 'rules' => 'required')));
     if ($keywords = post('keywords')) {
         redirect('search/' . rawurlencode($keywords) . '.html');
     } else {
         if ($search) {
             $value = $search;
         } else {
             $value = '';
         }
     }
     if ($value) {
         $keywords = $not_keywords = array();
         $results = array();
         $count = 0;
         foreach (array_map($trim = create_function('$a', 'return trim($a, \';,."\\\'\');'), preg_split('/[\\s;,.]*(-?"[^"]+")[\\s;,.]*|[\\s;,.]*(-?\'[^\']+\')[\\s;,.]*|[\\s;,.]+/', $value, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE)) as $keyword) {
             if (substr($keyword, 0, 1) == '-') {
                 $not_keywords[] = call_user_func($trim, substr($keyword, 1));
             } else {
                 $keywords[] = call_user_func($trim, $keyword);
             }
         }
         $keywords = array_filter($keywords);
         $not_keywords = array_filter($not_keywords);
         if ($keywords) {
             foreach ($this->get_modules() as $module) {
                 if (($search_controller = $module->load->controller('search')) && ($result = $search_controller->search($keywords, $not_keywords))) {
                     $results[$module->load->template->parse($search_controller->name, array(), $module->load)] = array($module, $search_controller, $result);
                     $count += count($result);
                 }
             }
         }
         ksort($results);
         if ($count == 0) {
             echo $this->load->view('unfound');
         } else {
             if ($count == 1) {
                 $this->add_data('search_count', '1 résultat trouvé');
             } else {
                 $this->add_data('search_count', $count . ' résultats trouvés');
             }
             if (1 || count($results) > 1) {
                 $modules = array();
                 foreach ($results as $title => $result) {
                     if (($name = url_title($result[0]->name)) == $module_name) {
                         $display = $result[0]->load->template->parse($result[1]->method('detail', array($result[2])), array(), $result[0]->load);
                         $details = TRUE;
                     } else {
                         if (!$module_name) {
                             $display = $result[0]->load->template->parse($result[1]->method('index', array($result[2])), array(), $result[0]->load);
                         } else {
                             $display = '';
                         }
                     }
                     $modules[] = array('name' => $name, 'title' => $title . ' (' . count($result[2]) . ')', 'display' => $display);
                 }
                 echo $this->load->view('results', array('search' => rawurlencode($value), 'modules' => $modules, 'details' => isset($details)));
             } else {
             }
         }
     } else {
         $value = '';
         echo $this->load->view('index');
     }
     $source = $this->db->select('CONCAT("\\"", keyword, "\\"")')->from('nf_search_keywords')->order_by('count DESC')->get();
     $this->subtitle($this->load->view('search', array('source' => utf8_htmlentities('[' . trim_word(implode(', ', $source), ', ') . ']'), 'value' => utf8_htmlentities($value))));
 }
Example #11
0
<?php

if (!defined('SECURITY_CONSTANT')) {
    exit;
}
echo '<form action="./install.php" method="POST">';
echo '<input type="hidden" name="step" value="2" />';
echo '<input type="hidden" name="language" value="', utf8_htmlentities($shortLanguageName), '" />';
include '../version.php';
echo utf8_htmlentities(translate('Your moodle version is') . ' ' . $version . ', ' . translate('release') . ' ' . $release), '<br />';
echo '<p>', utf8_htmlentities(translate('Is it correct?')), '<br /><br />';
echo '<input type="submit" name="option" value="', utf8_htmlentities(translate('Yes')), '" /> <input type="submit" name="option" value="', utf8_htmlentities(translate('No')), '" /></p>';
echo '</form>';
Example #12
0
 public function add_message($talk_id, $message)
 {
     if ($message = trim($message)) {
         $this->db->insert('nf_talks_messages', array('talk_id' => $talk_id, 'user_id' => $this->user('user_id'), 'message' => utf8_htmlentities($message)));
     }
 }
Example #13
0
    private function _display_text($var, $options, $post, $type = 'text')
    {
        $typeahead = isset($options['values']) && is_array($options['values']) && $options['values'] ? ' data-provide="typeahead" data-source="' . utf8_htmlentities('[' . trim_word(implode(', ', array_map(create_function('$a', 'return \'"\'.$a.\'"\';'), $options['values'])), ', ') . ']') . '"' : '';
        $classes = array();
        if (in_array($type, array('date', 'datetime', 'time'))) {
            $types = array('date' => 'L', 'datetime' => 'L LT', 'time' => 'LT');
            NeoFrag::loader()->css('bootstrap-datetimepicker.min')->js('bootstrap-datetimepicker/moment.min')->js('bootstrap-datetimepicker/bootstrap-datetimepicker.min')->js('bootstrap-datetimepicker/locales/' . $this->config->lang)->js_load('$(".input-group.' . $type . '").datetimepicker({allowInputToggle: true, locale: "' . $this->config->lang . '", format: "' . $types[$type] . '"});');
            $classes[] = $type;
            if (empty($options['icon'])) {
                $options['icon'] = $type == 'time' ? 'fa-clock-o' : 'fa-calendar';
            }
            $type = 'text';
        } else {
            if ($type == 'email') {
                $type = 'text';
                if (empty($options['icon'])) {
                    $options['icon'] = 'fa-envelope-o';
                }
            } else {
                if ($type == 'url') {
                    $type = 'text';
                    if (empty($options['icon'])) {
                        $options['icon'] = 'fa-globe';
                    }
                } else {
                    if ($type == 'colorpicker') {
                        $type = 'text';
                        $classes[] = 'color';
                        $options['icon'] = FALSE;
                        NeoFrag::loader()->css('bootstrap-colorpicker.min')->js('bootstrap-colorpicker.min')->js_load('$(".input-group.color").colorpicker({format: "hex", component: ".input-group-addon,input", colorSelectors: ' . json_encode(get_colors()) . '});');
                    }
                }
            }
        }
        $output = '';
        if (isset($options['icon'])) {
            $output .= '<div class="input-group' . (!empty($classes) ? ' ' . implode(' ', $classes) : '') . '">
				<span class="input-group-addon">' . ($options['icon'] ? icon($options['icon']) : '<i></i>') . '</span>';
        }
        if ($type != 'file') {
            $class = ' class="form-control"';
            $value = ' value="' . addcslashes($this->_display_value($var, $options), '"') . '"';
        }
        $input = '<input id="form_' . $this->id . '_' . $var . '" name="' . $this->id . '[' . $var . ']" type="' . $type . '"' . (!empty($value) ? $value : '') . $typeahead . (!empty($class) ? $class : '') . (($type == 'password' || $typeahead) && isset($options['autocomplete']) && $options['autocomplete'] === FALSE ? ' autocomplete="off"' : '') . (!empty($options['rules']) && in_array('disabled', $options['rules']) ? ' disabled="disabled"' : '') . ($this->_fast_mode && !empty($options['label']) && $type != 'file' ? ' placeholder="' . $this->load->lang($options['label'], NULL) . '"' : '') . ' />';
        if ($type == 'file') {
            $post = post();
            $input = '<div style="margin: 7px 0;"><p>' . icon('fa-download') . ' ' . NeoFrag::loader()->lang('upload_file') . (!empty($options['info']) ? $options['info'] : '') . '</p>' . $input . '</div>';
            if (!empty($options['value'])) {
                if (isset($post[$this->id][$var]) && $post[$this->id][$var] == 'delete') {
                    $input = '<input type="hidden" name="' . $this->id . '[' . $var . ']" value="delete" />' . $input;
                } else {
                    $input = '	<div class="row">
									<div class="col-md-3">
										<div class="thumbnail no-margin">
											<img src="' . url($this->db->select('path')->from('nf_files')->where('file_id', $options['value'])->row()) . '" alt="" />
											<div class="caption text-center">
												<a class="btn btn-outline btn-danger btn-xs form-file-delete" href="#" data-input="' . $this->id . '[' . $var . ']">' . icon('fa-trash-o') . ' ' . NeoFrag::loader()->lang('remove') . '</a>
											</div>
										</div>
									</div>
									<div class="col-md-9">
										' . $input . '
									</div>
								</div>';
                }
            }
        }
        $output .= $input;
        if (isset($options['icon'])) {
            if (in_array('color', $classes)) {
                $output .= '<span class="input-group-addon"><span class="fa fa-eyedropper"></span></span>';
            }
            $output .= '</div>';
        }
        return $output;
    }
Example #14
0
/**
 * This function sets the data in the database to the good format. This function
 * have this properties:
 * 1 - does not depend on the previous version: it has to discover which changes to apply
 * 2 - (a corolary of 1) is idempotent, i.e, f(f(x)) = f(x)
 * **/
function wrsqz_update_database()
{
    //update shortanswer wirisCASForComputations field
    $updates = 0;
    $shortanswertable = new XMLDBTable('question_shortanswerwiris');
    if (table_exists($shortanswertable)) {
        $eqoptionfield = new XMLDBField('eqoption');
        if (field_exists($shortanswertable, $eqoptionfield)) {
            $saq = get_records('question_shortanswerwiris');
            foreach ($saq as $question) {
                if (trim($question->eqoption) != '') {
                    $decodedEqoption = array();
                    mb_parse_str($question->eqoption, $decodedEqoption);
                    if (isset($decodedEqoption['wirisCASForComputations'])) {
                        $wirisCASForComputations = $decodedEqoption['wirisCASForComputations'];
                        unset($decodedEqoption['wirisCASForComputations']);
                        $question->eqoption = http_build_query($decodedEqoption, null, '&');
                        if (!empty($question->options)) {
                            $options = unserialize($question->options);
                        } else {
                            $options = array();
                        }
                        $options['wirisCASForComputations'] = $wirisCASForComputations;
                        $question->options = serialize($options);
                        update_record('question_shortanswerwiris', $question);
                        $updates++;
                    }
                }
            }
        }
    }
    if ($updates) {
        echo utf8_htmlentities(translate('Updated shortanswer wirisCASForComputations field: ')) . $updates . utf8_htmlentities(translate(' records')) . '<br />';
    }
}
Example #15
0
    public function display()
    {
        NeoFrag::loader()->css('neofrag.table')->js('neofrag.table');
        $output = '';
        $search = trim(post('search'));
        if (post('table_id')) {
            if (post('table_id') == $this->id) {
                $this->config->ajax_url = TRUE;
                $this->_ajax = TRUE;
            } else {
                $this->reset();
                return;
            }
        }
        if (!is_null($session_sort = $this->session('table', $this->id, 'sort'))) {
            foreach ($session_sort as $session) {
                list($column_id, $order) = $session;
                $this->sort_by($column_id, $order);
            }
        }
        if ($this->_pagination && !empty($this->pagination) && !is_null($items_per_page = $this->session('table', $this->id, 'items_per_page'))) {
            $this->pagination->set_items_per_page($items_per_page);
        }
        if (!is_null($sort = post('sort')) && $this->_ajax) {
            list($column_id, $order) = json_decode($sort);
            if (in_array($order, array('asc', 'desc', 'none'))) {
                if ($order == 'asc') {
                    $order = SORT_ASC;
                } else {
                    if ($order == 'desc') {
                        $order = SORT_DESC;
                    } else {
                        if ($order == 'none') {
                            $order = -1;
                        }
                    }
                }
                $added = FALSE;
                if (!is_null($session_sort = $this->session('table', $this->id, 'sort'))) {
                    foreach ($session_sort as $i => $session) {
                        if ($column_id == $session[0]) {
                            $added = TRUE;
                            if ($order != -1 || isset($this->_sortings[$column_id])) {
                                $this->session->set('table', $this->id, 'sort', $i, array($column_id, $order));
                            } else {
                                $this->session->destroy('table', $this->id, 'sort', $i);
                            }
                        }
                    }
                }
                if (!$added) {
                    $this->session->add('table', $this->id, 'sort', array($column_id, $order));
                }
                $this->sort_by($column_id, $order);
            }
            $search = $this->session('table', $this->id, 'search');
        }
        $count_results = $this->_pagination && !empty($this->pagination) ? $this->pagination->count() : count($this->_data);
        if ($this->_is_searchable() && $search && $this->_pagination && !empty($this->pagination)) {
            $this->_data = $this->pagination->display_all();
        } else {
            if (!empty($this->_sortings) && $this->_pagination && !empty($this->pagination) && (!isset($search) || !$search)) {
                $this->_data = $this->pagination->get_data();
            }
        }
        $this->_preprocessing();
        //Gestion des recherches
        if ($this->_is_searchable()) {
            if ($search) {
                $results = array();
                $words = explode(' ', trim($search));
                foreach ($this->_data as $data_id => $data) {
                    $found = 0;
                    $data = array_merge(array('data_id' => $data_id), $data);
                    foreach ($this->_columns as $value) {
                        if (!isset($value['search']) || is_null($value['search'])) {
                            continue;
                        }
                        $value = $this->template->parse($value['search'], $data, $this->load);
                        foreach ($words as $word) {
                            if (in_string($word, $value, FALSE)) {
                                $found++;
                            }
                        }
                        if ($found == count($words)) {
                            break;
                        }
                    }
                    if ($found == count($words)) {
                        $results[] = $data;
                    }
                }
                $this->session->set('table', $this->id, 'search', $search);
                $this->_data = $results;
                $this->_no_data = NeoFrag::loader()->lang('no_result');
            } else {
                $this->session->destroy('table', $this->id, 'search');
            }
            $words = array();
            foreach ($this->_data as $data_id => $data) {
                $data = array_merge(array('data_id' => $data_id), $data);
                foreach ($this->_columns as $value) {
                    if (!isset($value['search']) || is_null($value['search'])) {
                        continue;
                    }
                    $this->_words[] = $value = $this->template->parse($value['search'], $data, $this->load);
                    $words[] = '"' . $value . '"';
                }
            }
        }
        if (empty($this->_data)) {
            $output = '<div class="clearfix"></div>' . ($this->_no_data ?: NeoFrag::loader()->lang('no_data'));
        } else {
            if (!$this->_ajax && $this->_is_searchable()) {
                $search_input = '	<div class="table-search pull-left">
										<div class="form-group has-feedback">
											<input class="form-control" data-provide="typeahead" data-items="5" data-source="' . utf8_htmlentities('[' . trim_word(implode(', ', array_unique($words)), ', ') . ']') . '" type="text"' . (isset($search) ? ' value="' . $search . '"' : '') . ' placeholder="' . NeoFrag::loader()->lang('search') . '" autocomplete="off" />
										</div>
									</div>';
            }
            //Gestion des tris
            if (!empty($this->_sortings)) {
                $sortings = array();
                foreach ($this->_sortings as $column => $order) {
                    if (!isset($this->_columns[$column]) || !isset($this->_columns[$column]['sort']) || $order[0] == -1) {
                        continue;
                    }
                    $tmp = array();
                    foreach ($this->_data as $data_id => $data) {
                        $data = array_merge(array('data_id' => $data_id), $data);
                        $tmp[] = $this->template->parse($this->_columns[$column]['sort'], $data, $this->load);
                    }
                    $sortings[] = array_map('strtolower', $tmp);
                    $sortings = array_merge($sortings, $order);
                }
                $data = array();
                foreach ($this->_data as $key => $value) {
                    $data[$key . ' '] = $value;
                }
                $sortings[] =& $data;
                call_user_func_array('array_multisort', $sortings);
                $this->_data = array();
                foreach ($data as $key => $value) {
                    $this->_data[trim($key)] = $value;
                }
                if ($this->_pagination && !empty($this->pagination) && ($items_per_page = $this->pagination->get_items_per_page()) > 0) {
                    $this->_data = array_slice($this->_data, ($this->pagination->get_page() - 1) * $items_per_page, $items_per_page);
                }
            }
            if ($this->_pagination && !empty($this->pagination) && $this->pagination->count() > 10) {
                $output .= '<div class="form-group pull-left">
								<select class="form-control" style="width: auto;" onchange="window.location=\'' . $this->pagination->get_url() . '/\'+$(this).find(\'option:selected\').data(\'url\')+\'.html\'" autocomplete="off">
									<option value="10"' . ($this->pagination->get_items_per_page() == 10 ? ' selected="selected"' : '') . ' data-url="page/1/10">' . NeoFrag::loader()->lang('results', 10, 10) . '</option>
									<option value="25"' . ($this->pagination->get_items_per_page() == 25 ? ' selected="selected"' : '') . ' data-url="page/1/25">' . NeoFrag::loader()->lang('results', 25, 25) . '</option>
									<option value="50"' . ($this->pagination->get_items_per_page() == 50 ? ' selected="selected"' : '') . ' data-url="page/1/50">' . NeoFrag::loader()->lang('results', 50, 50) . '</option>
									<option value="100"' . ($this->pagination->get_items_per_page() == 100 ? ' selected="selected"' : '') . ' data-url="page/1/100">' . NeoFrag::loader()->lang('results', 100, 100) . '</option>
									<option value="all"' . ($this->pagination->get_items_per_page() == 0 ? ' selected="selected"' : '') . ' data-url="all">' . NeoFrag::loader()->lang('show_all') . '</option>
								</select>
							</div>';
            }
            if ($this->_pagination && !empty($this->pagination) && ($pagination = $this->pagination->get_pagination()) != '') {
                $output .= '<div class="form-group pull-right">' . $pagination . '</div>';
            }
            $count = count($this->_data);
            $output .= '<div class="table-responsive"><table class="table table-hover table-striped">';
            if ($this->_display_header()) {
                $output .= '<thead>';
                $header = '			<tr class="navbar-inner">';
                $i = 0;
                foreach ($this->_columns as $th) {
                    $width = isset($th['size']) ? $th['size'] : FALSE;
                    $class = array();
                    $sort = '';
                    if ($width === TRUE) {
                        $class[] = 'action';
                    }
                    if (!empty($this->_data) && isset($th['sort'])) {
                        $class[] = 'sort';
                        $sort = ' data-column="' . ($i + 1) . '"';
                        if (isset($this->_sortings[$i]) && $this->_sortings[$i][0] == SORT_ASC) {
                            $class[] = 'sorting_asc';
                            $sort .= ' data-order-by="desc"';
                        } else {
                            if (isset($this->_sortings[$i]) && $this->_sortings[$i][0] == SORT_DESC) {
                                $class[] = 'sorting_desc';
                                $sort .= ' data-order-by="none"';
                            } else {
                                $class[] = 'sorting';
                                $sort .= ' data-order-by="asc"';
                            }
                        }
                    }
                    $header .= '		<th' . (!empty($class) ? ' class="' . implode(' ', $class) . '"' : '') . (!is_bool($width) ? ' style="width: ' . $width . ';"' : '') . (!empty($sort) ? $sort : '') . '>' . (!empty($th['title']) ? $th['title'] : '') . '</th>';
                    $i++;
                }
                $header .= '		</tr>';
                $output .= $header . '
								</thead>';
            }
            $output .= '	<tbody>';
            foreach ($this->_data as $data_id => $data) {
                $data = array_merge(array('data_id' => $data_id), $data);
                $output .= '<tr>';
                foreach ($this->_columns as $value) {
                    if (is_array($value['content'])) {
                        $actions = array();
                        foreach ($value['content'] as $val) {
                            $actions[] = $this->template->parse($val, $data, $this->load);
                        }
                        $output .= '<td class="action">' . implode('&nbsp;', array_filter($actions)) . '</td>';
                    } else {
                        $content = $this->template->parse($value['content'], $data, $this->load);
                        if (!isset($value['td']) || $value['td']) {
                            $classes = array();
                            if (isset($value['size']) && $value['size'] === TRUE) {
                                $classes[] = 'action';
                            }
                            if (!empty($value['class'])) {
                                $classes[] = $value['class'];
                            }
                            if (!empty($value['align']) && in_array($value['align'], array('left', 'center', 'right'))) {
                                $classes[] = 'text-' . $value['align'];
                            }
                            $content = '<td' . (!empty($classes) ? ' class="' . implode(' ', $classes) . '"' : '') . '>' . $content . '</td>';
                        }
                        $output .= $content;
                    }
                }
                $output .= '</tr>';
            }
            $output .= '	</tbody>';
            if ($this->_pagination && !empty($this->pagination) && $this->pagination->get_items_per_page() >= 50 && $count >= 50) {
                $output .= '<tfoot>' . $header . '</tfoot>';
            }
            $output .= '</table></div>';
            if (!empty($pagination)) {
                $output .= '<div class="pull-right">' . $pagination . '</div>';
            }
            $output .= '<i>' . NeoFrag::loader()->lang('results', $count, $count) . ($count < $count_results ? NeoFrag::loader()->lang('results_total', $count_results) : '') . '</i>';
            if (!$this->_ajax) {
                $output = '<div class="table-area" data-table-id="' . $this->id . '"' . ($this->config->ajax_url ? ' data-ajax-url="' . url($this->config->request_url) . '"  data-ajax-post="' . http_build_query(post()) . '"' : '') . '>' . (isset($search_input) ? $search_input : '') . '<div class="table-content">' . $output . '</div></div>';
            }
        }
        $this->reset();
        if ($this->_ajax) {
            $this->session->save();
            echo $output;
            return '';
        } else {
            return $output;
        }
    }
Example #16
0
<?php

if (!defined('SECURITY_CONSTANT')) {
    exit;
}
echo '<br /><b>Welcome to WIRIS Quizzes installation.</b><br /><br />';
echo '<form method="POST" action="./install.php">';
echo '<input type="hidden" name="step" value="1" />';
echo 'Select installation language: <select name="language">';
// Loading language list. Each language file has setted "$languageName" variable.
echo '<option value="en">English</option>';
$languageFileList = opendir('./install/lang/');
while (($languageFile = readdir($languageFileList)) !== false) {
    if ($languageFile != '.' and $languageFile != '..' and substr($languageFile, strlen($languageFile) - 4, 4) == '.php') {
        include './install/lang/' . $languageFile;
        $shortLanguageName = substr($languageFile, 0, strlen($languageFile) - 4);
        echo '<option value="', utf8_htmlentities($shortLanguageName), '">', $languageName, '</option>';
    }
}
closedir($languageFileList);
echo '</select>';
//---------------
echo '<br /><br />';
echo '<input type="submit" value="Continue" />';
echo '</form>';
Example #17
0
function printReinstall()
{
    echo '<div align="left">';
    echo '<form action="./install.php" method="POST">';
    echo '<input type="hidden" name="step" value="3" />';
    echo '<input type="hidden" name="language" value="', utf8_htmlentities($shortLanguageName), '" />';
    echo '<br>';
    echo utf8_htmlentities(translate('WIRIS Quizzes is already installed.'));
    echo '<ul><li>';
    echo utf8_htmlentities(translate('If you want to upgrade from a previous version or reinstall it, please click to Reinstall button.')), '<br />';
    echo '<div align="center"><br /><input type="submit" name="restore" value="', utf8_htmlentities(translate('Reinstall')), '"><br /><br /></div>';
    echo '</li><li>';
    echo utf8_htmlentities(translate('If you want to uninstall the currently installed WIRIS Quizzes manually, please see the ')), '<a href="http://www.wiris.com/documents/quizzes-uninstall.html">', utf8_htmlentities(translate('uninstall documentation')), '</a>.';
    echo '</li></ul>';
    //echo errorMessage('acthtml');
    echo '<br />';
    echo '<div id="information">';
    echo 'If you click to Reinstall button...';
    echo '<ul>';
    echo '<li>../question/question.php.old ', utf8_htmlentities(translate('will be restored to')), ' ../question/question.php</li>';
    echo '<li>../lib/questionlib.php.old ', utf8_htmlentities(translate('will be restored to')), ' ../lib/questionlib.php</li>';
    echo '</ul>';
    echo '</div>';
    echo '</form>';
    echo '</div>';
}
Example #18
0
<?php

if (!defined('SECURITY_CONSTANT')) {
    exit;
}
if (isset($_POST['option']) and $_POST['option'] == translate('Yes')) {
    echo '<form action="./install.php" method="POST">';
    echo '<input type="hidden" name="step" value="3" />';
    echo '<input type="hidden" name="language" value="', utf8_htmlentities($shortLanguageName), '" />';
    echo translate('Do you want to install WIRIS Quizzes in your moodle?'), '<br /><br />';
    echo '<input type="submit" name="option" value="', utf8_htmlentities(translate('Yes')), '" /> <input type="submit" name="option" value="', utf8_htmlentities(translate('No')), '" /><br />';
    echo '<div id="information">';
    echo utf8_htmlentities(translate('If you click on "Yes"')), ':';
    echo '<ul>';
    echo '<li>./questiontypes/ ', utf8_htmlentities(translate('will be copyed on')), ' ../question/type/</li>';
    echo '<li>../lib/questionlib.php ', utf8_htmlentities(translate('will be backuped to')), ' ../lib/questionlib.php.old</li>';
    echo '<li>../lib/questionlib.php ', utf8_htmlentities(translate('will be modified')), '</li>';
    echo '<li>../question/question.php ', utf8_htmlentities(translate('will be backuped to')), ' ../question/question.php.old</li>';
    echo '<li>../question/question.php ', utf8_htmlentities(translate('will be modified')), '</li>';
    //echo '<li>./lang/ ', utf8_htmlentities(translate('will be copyed on')), utf8_htmlentities(translate(' your language folder.'));
    echo '</ul>';
    echo utf8_htmlentities(translate('If you click no "No"')), ':';
    echo '<ul>';
    echo '<li>', utf8_htmlentities(translate('Manual installation will be able')), '</li>';
    echo '</ul>';
    echo '</div>';
} else {
    echo errorMessage();
}
Example #19
0
<?php

if (!defined('SECURITY_CONSTANT')) {
    exit;
}
echo '<br /><br />';
echo '<b>' . utf8_htmlentities(translate('Thanks for use WIRIS Quizzes!')), '<br /><br /></b>';
echo '<div align="left"><ul><li>';
echo utf8_htmlentities(translate('See the ')), '<a href="http://www.wiris.com/documents/quizzes-user-manual.html">', utf8_htmlentities(translate('user manual')), '</a>', utf8_htmlentities(translate(' to know all the features of WIRIS Quizzes.'));
echo '</li><li>';
echo utf8_htmlentities(translate('If you ever want to uninstall WIRIS Quizzes, see the')), ' <a href="http://www.wiris.com/documents/quizzes-uninstall.html">', utf8_htmlentities(translate('uninstall documentation')), '</a>.';
echo '</li></ul>';
echo '</div>';
echo '<a href="..">', utf8_htmlentities(translate('Go to my moodle')), '</a>';
Example #20
0
 public function index($settings = array())
 {
     return array('align' => in_array($settings['align'], array('text-left', 'text-right')) ? $settings['align'] : 'text-center', 'title' => utf8_htmlentities($settings['title']), 'description' => utf8_htmlentities($settings['description']), 'color-title' => preg_match($regex = '/^#([a-f0-9]{3}){1,2}$/i', $settings['color-title']) ? $settings['color-title'] : '', 'color-description' => preg_match($regex, $settings['color-description']) ? $settings['color-description'] : '');
 }
Example #21
0
 public function widget_update($disposition_id, $disposition, $row_id, $col_id, $widget_id, $id, $widget, $type, $title, $settings)
 {
     $settings = $this->load->widget($widget)->get_settings($type, $settings);
     $this->db->where('widget_id', $id)->update('nf_widgets', array('title' => $title ? utf8_htmlentities($title) : NULL, 'widget' => $widget, 'type' => $type, 'settings' => $settings));
     return $disposition[$row_id]->cols[$col_id]->widgets[$widget_id]->display($widget_id);
 }