Format code

ofaj
jmontoyaa 9 years ago
parent d6381bee81
commit 7e13c9243d
  1. 1
      main/work/download.php
  2. 2
      main/work/edit.php
  3. 8
      main/work/work.php
  4. 14
      main/work/work_list_all.php
  5. 122
      main/work/work_list_others.php
  6. 2
      main/work/work_missing.php
  7. 33
      tests/main/work/work.lib.test.php

@ -27,7 +27,6 @@ if (empty($courseInfo)) {
}
$correction = isset($_REQUEST['correction']) ? true : false;
$result = downloadFile($id, $courseInfo, $correction);
if ($result == false) {
api_not_allowed(true);

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_STUDENTPUBLICATION;

@ -1,12 +1,12 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* @package chamilo.work
**/
use ChamiloSession as Session;
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_STUDENTPUBLICATION;
@ -43,12 +43,12 @@ $base_work_dir = $course_dir . '/work';
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'list';
//Download folder
if ($action == 'downloadfolder') {
if ($action === 'downloadfolder') {
require 'downloadfolder.inc.php';
}
$display_upload_form = false;
if ($action == 'upload_form') {
if ($action === 'upload_form') {
$display_upload_form = true;
}

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_STUDENTPUBLICATION;
@ -169,23 +167,19 @@ if (api_is_allowed_to_session_edit(false, true) && !empty($workId) && !$isDrhOfC
$display_output = '<a href="'.api_get_path(WEB_CODE_PATH).'work/work_missing.php?'.api_get_cidreq().'&amp;id='.$workId.'&amp;list=without">'.
Display::return_icon('exercice_uncheck.png', get_lang('ViewUsersWithoutTask'), '', ICON_SIZE_MEDIUM)."</a>";
$actionsLeft .= '<a href="'.api_get_path(WEB_CODE_PATH).'work/edit_work.php?'.api_get_cidreq().'&id='.$workId.'">';
$actionsLeft .= Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM).'</a>';
$count = get_count_work($workId);
if ($count > 0) {
$display_output .= '<a class="btn-toolbar" href="downloadfolder.inc.php?id='.$workId.'&'.api_get_cidreq().'">'.
Display::return_icon('save_pack.png', get_lang('LowerPackageTasks'), null, ICON_SIZE_MEDIUM).' '.get_lang('LowerPackageTasks').'</a>';
}
$actionsLeft .= $display_output;
$url = api_get_path(WEB_CODE_PATH).'work/upload_corrections.php?'.api_get_cidreq().'&id='.$workId;
$actionsLeft .= '<a class="btn-toolbar" href="'.$url.'">'.Display::return_icon('upload_package.png', get_lang('UpPackageFixes'), '', ICON_SIZE_MEDIUM) . ' ' . get_lang('UpPackageFixes') . '</a>';
//$actionsLeft .= Display::toolbarButton(get_lang('UploadCorrections'), $url, 'upload', 'success');
$actionsLeft .= '<a class="btn-toolbar" href="'.$url.'">'.
Display::return_icon('upload_package.png', get_lang('UpPackageFixes'), '', ICON_SIZE_MEDIUM) . ' ' . get_lang('UpPackageFixes') . '</a>';
}
echo Display::toolbarAction('toolbar-worklist', array($actionsLeft), 1);

@ -2,6 +2,7 @@
/* For licensing terms, see /license.txt */
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_STUDENTPUBLICATION;
api_protect_course_script(true);
@ -36,7 +37,7 @@ protectWork($courseInfo, $workId);
$htmlHeadXtra[] = api_get_jqgrid_js();
if (!empty($group_id)) {
$group_properties = GroupManager :: get_group_properties($group_id);
$group_properties = GroupManager :: get_group_properties($group_id);
$show_work = false;
if (api_is_allowed_to_edit(false, true)) {
@ -99,27 +100,100 @@ if (!empty($work_data['enable_qualification']) && !empty($check_qualification))
get_lang('Actions')
);
$column_model = array(
array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'),
array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => 'true'),
array('name'=>'qualification', 'index'=>'qualification', 'width'=>'20', 'align'=>'left', 'search' => 'true'),
array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'),
array('name'=>'qualificator_id','index'=>'qualificator_id', 'width'=>'30', 'align'=>'left', 'search' => 'true'),
array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
array(
'name' => 'type',
'index' => 'file',
'width' => '12',
'align' => 'left',
'search' => 'false',
'sortable' => 'false',
),
array('name' => 'firstname', 'index' => 'firstname', 'width' => '35', 'align' => 'left', 'search' => 'true'),
array('name' => 'lastname', 'index' => 'lastname', 'width' => '35', 'align' => 'left', 'search' => 'true'),
array(
'name' => 'title',
'index' => 'title',
'width' => '40',
'align' => 'left',
'search' => 'false',
'wrap_cell' => 'true',
),
array(
'name' => 'qualification',
'index' => 'qualification',
'width' => '20',
'align' => 'left',
'search' => 'true',
),
array(
'name' => 'sent_date',
'index' => 'sent_date',
'width' => '50',
'align' => 'left',
'search' => 'true',
'wrap_cell' => 'true',
),
array(
'name' => 'qualificator_id',
'index' => 'qualificator_id',
'width' => '30',
'align' => 'left',
'search' => 'true',
),
array(
'name' => 'actions',
'index' => 'actions',
'width' => '40',
'align' => 'left',
'search' => 'false',
'sortable' => 'false',
),
);
} else {
$type = 'complex';
$columns = array(
get_lang('Type'), get_lang('FirstName'), get_lang('LastName'), get_lang('Title'), get_lang('Date'), get_lang('Actions')
$columns = array(
get_lang('Type'),
get_lang('FirstName'),
get_lang('LastName'),
get_lang('Title'),
get_lang('Date'),
get_lang('Actions'),
);
$column_model = array(
array('name'=>'type', 'index'=>'file', 'width'=>'12', 'align'=>'left', 'search' => 'false', 'sortable' => 'false'),
array('name'=>'firstname', 'index'=>'firstname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
array('name'=>'lastname', 'index'=>'lastname', 'width'=>'35', 'align'=>'left', 'search' => 'true'),
array('name'=>'title', 'index'=>'title', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'wrap_cell' => "true"),
array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'wrap_cell' => 'true'),
array('name'=>'actions', 'index'=>'actions', 'width'=>'40', 'align'=>'left', 'search' => 'false', 'sortable'=>'false')
array(
'name' => 'type',
'index' => 'file',
'width' => '12',
'align' => 'left',
'search' => 'false',
'sortable' => 'false',
),
array('name' => 'firstname', 'index' => 'firstname', 'width' => '35', 'align' => 'left', 'search' => 'true'),
array('name' => 'lastname', 'index' => 'lastname', 'width' => '35', 'align' => 'left', 'search' => 'true'),
array(
'name' => 'title',
'index' => 'title',
'width' => '40',
'align' => 'left',
'search' => 'false',
'wrap_cell' => "true",
),
array(
'name' => 'sent_date',
'index' => 'sent_date',
'width' => '50',
'align' => 'left',
'search' => 'true',
'wrap_cell' => 'true',
),
array(
'name' => 'actions',
'index' => 'actions',
'width' => '40',
'align' => 'left',
'search' => 'false',
'sortable' => 'false',
),
);
}
@ -129,13 +203,13 @@ $extra_params['height'] = 'auto';
$extra_params['sortname'] = 'firstname';
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_work_user_list_others&work_id='.$workId.'&type='.$type;
?>
<script>
$(function() {
<?php
echo Display::grid_js('results', $url, $columns, $column_model, $extra_params);
?>
});
</script>
<script>
$(function() {
<?php
echo Display::grid_js('results', $url, $columns, $column_model, $extra_params);
?>
});
</script>
<?php
echo Display::grid_html('results');

@ -4,8 +4,6 @@
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_STUDENTPUBLICATION;
/* Configuration settings */
api_protect_course_script(true);
// Including necessary files

@ -63,14 +63,6 @@ class TestWork extends UnitTestCase {
//var_dump($res);
}
function testconvert_date_to_array() {
$date=date('d/m/Y',time());
$group=array();
$res=convert_date_to_array($date,$group);
$this->assertTrue(is_array($res));
//var_dump($res);
}
/**
* This function displays the number of files contained in a directory
* @param string the path of the directory complete e.g. /var/www/dokeos
@ -88,19 +80,7 @@ class TestWork extends UnitTestCase {
ob_end_clean();
//var_dump($res);
}
/**
* create a group of select from a date
* @return array list
*/
function testcreate_group_date_select() {
$res=create_group_date_select($prefix='');
$this->assertTrue(is_array($res));
//var_dump($res);
}
/**
* Transform an all directory structure (only directories) in an array
* @param string path of the directory
@ -177,17 +157,6 @@ class TestWork extends UnitTestCase {
//var_dump($res);
}
/**
* create a group of select from a date
*/
function testget_date_from_group() {
$group='';
$res=get_date_from_group($group);
$this->assertTrue(is_string($res));
//var_dump($res);
}
/**
* @param string Path of the directory
* @return array The list of ids of all the directories in the path

Loading…
Cancel
Save