Adding widescale_exam plugin

skala
Julio Montoya 12 years ago
parent 723a64670e
commit 2258e8f684
  1. 13
      plugin/widescale_exam/index.php
  2. 28
      plugin/widescale_exam/install.php
  3. 23
      plugin/widescale_exam/plugin.php
  4. 1
      plugin/widescale_exam/readme.txt
  5. 5
      plugin/widescale_exam/template.tpl
  6. 13
      plugin/widescale_exam/uninstall.php
  7. 71
      plugin/widescale_exam/user_list.php

@ -0,0 +1,13 @@
<?php
$url = api_get_path(WEB_PLUGIN_PATH).'widescale_exam/user_list.php';
if (api_is_drh() || api_is_platform_admin()) {
echo '<div id="course_block" class="well sidebar-nav">
<h4>Reporte</h4>
<ul class="nav nav-list">
<a href="'.$url.'">Lista de usuarios</a>
</ul>';
echo '</div>';
}

@ -0,0 +1,28 @@
<?php
//Adding extra fields
$extra_field = new ExtraField('user');
$params = array(
'field_type' => ExtraField::FIELD_TYPE_TEXT,
'field_variable' => 'exam_room',
'field_display_text' => 'Aula',
'field_visible' => false
);
$extra_field->save($params);
$params = array(
'field_type' => ExtraField::FIELD_TYPE_TEXT,
'field_variable' => 'exam_schedule',
'field_display_text' => 'Horario',
'field_visible' => false
);
$extra_field->save($params);
$params = array(
'field_type' => ExtraField::FIELD_TYPE_TEXT,
'field_variable' => 'exam_password',
'field_display_text' => 'Password',
'field_visible' => false
);
$extra_field->save($params);

@ -0,0 +1,23 @@
<?php
/**
* This script is a configuration file for the date plugin. You can use it as a master for other platform plugins (course plugins are slightly different).
* These settings will be used in the administration interface for plugins (Chamilo configuration settings->Plugins)
* @package chamilo.plugin
* @author Julio Montoya <gugli100@gmail.com>
*/
/**
* Plugin details (must be present)
*/
//the plugin title
$plugin_info['title'] = 'Wide scale exam';
//the comments that go with the plugin
$plugin_info['comment'] = "";
//the plugin version
$plugin_info['version'] = '1.0';
//the plugin author
$plugin_info['author'] = 'Julio Montoya';
//set the smarty templates that are going to be used
//$plugin_info['templates'] = array('template.tpl');

@ -0,0 +1 @@
Display static content.

@ -0,0 +1,5 @@
{% if _u.logged == 1 %}
<div class="well">
hello
</div>
{% endif %}

@ -0,0 +1,13 @@
<?php
//Removing extra fields
$extra_fields = array('exam_room', 'exam_schedule', 'exam_password');
foreach($extra_fields as $extra) {
$extra_field = new ExtraField('user');
$field_info = $extra_field->get_handler_field_info_by_field_variable($extra);
if (isset($field_info['id'])) {
$extra_field->delete($field_info['id']);
}
}

@ -0,0 +1,71 @@
<?php
require_once '../../main/inc/global.inc.php';
//Add the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_jqgrid_js();
$allowed = api_is_platform_admin() || api_is_drh();
if (!$allowed) {
api_not_allowed(true);
}
Display::display_header($tool_name);
//jqgrid will use this URL to do the selects
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_user_list_plugin_widescale';
//The order is important you need to check the the $column variable in the model.ajax.php file
$columns = array(get_lang('Username'), get_lang('Firstname'), get_lang('Lastname'), get_lang('Password'));
//Column config
$column_model = array(
array('name'=>'username', 'index'=>'username', 'width'=>'100', 'align'=>'left'),
array('name'=>'firstname', 'index'=>'firstname', 'width'=>'100', 'align'=>'left'),
array('name'=>'lastname', 'index'=>'lastname', 'width'=>'100', 'align'=>'left'),
array('name'=>'exam_password', 'index'=>'exam_password', 'width'=>'100', 'align'=>'left','sortable'=>'false'),
//array('name'=>'actions', 'index'=>'actions', 'width'=>'100', 'align'=>'left','formatter'=>'action_formatter','sortable'=>'false')
);
//Autowidth
$extra_params['autowidth'] = 'true';
//height auto
$extra_params['height'] = 'auto';
//With this function we can add actions to the jgrid (edit, delete, etc)
/*
$action_links = 'function action_formatter(cellvalue, options, rowObject) {
return \'<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'.
'&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?sec_token='.$token.'&action=copy&id=\'+options.rowId+\'">'.Display::return_icon('copy.png',get_lang('Copy'),'',ICON_SIZE_SMALL).'</a>'.
'&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
'\';
}';*/
$room = UserManager::get_extra_user_data_by_field(api_get_user_id(), 'exam_room');
$room = $room['exam_room'];
$schedule = UserManager::get_extra_user_data_by_field(api_get_user_id(), 'exam_schedule');
$schedule = $schedule['exam_schedule'];
echo Display::page_subheader(get_lang('UserList').": ".$room." - ".$schedule);
?>
<script>
$(function() {
<?php
echo Display::grid_js('user_list', $url, $columns, $column_model, $extra_params, array(), $action_links, true);
?>
jQuery("#user_list").jqGrid("navGrid","#user_list_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
jQuery("#user_list").jqGrid("navButtonAdd","#user_list_pager",{
caption:"",
onClickButton : function () {
jQuery("#user_list").jqGrid("excelExport",{"url": "<? echo $url?>&export_format=xls"});
}
});
});
</script>
<?php
echo Display::grid_html('user_list');
Display :: display_footer();
Loading…
Cancel
Save