Minor - format code.

pull/2487/head
jmontoyaa 8 years ago
parent 45827024e1
commit 1f8b52f300
  1. 3
      main/dashboard/block.class.php
  2. 12
      main/dashboard/dashboard.php
  3. 4
      main/dashboard/index.php
  4. 4
      main/dashboard/layout.php
  5. 84
      main/document/create_document.php
  6. 3
      main/dropbox/dropbox_class.inc.php
  7. 4
      main/dropbox/dropbox_download.php
  8. 4
      main/dropbox/dropbox_functions.inc.php
  9. 23
      main/dropbox/dropbox_init.inc.php
  10. 34
      main/dropbox/index.php
  11. 9
      main/dropbox/recover_dropbox_files.php
  12. 10
      main/inc/lib/sessionmanager.lib.php
  13. 1
      main/session/scheduled_announcement.php

@ -15,7 +15,6 @@ class Block
*/
public function __construct()
{
}
/**
@ -23,7 +22,6 @@ class Block
*/
public function display_small()
{
}
/**
@ -31,7 +29,6 @@ class Block
*/
public function display_large()
{
}
public function get_block_path()

@ -58,9 +58,9 @@ if (isset($dashboard_view) && $dashboard_view == 'blocks') {
// blocks for column 1
if (in_array('column_1', $columns_name)) {
echo '<div id="column1" class="col-md-6">';
foreach ($columns['column_1'] as $content) {
echo $content;
}
foreach ($columns['column_1'] as $content) {
echo $content;
}
echo '</div>';
} else {
echo '<div id="column1" class="col-md-6">';
@ -71,9 +71,9 @@ if (isset($dashboard_view) && $dashboard_view == 'blocks') {
if (in_array('column_2', $columns_name)) {
// blocks for column 1
echo '<div id="column2" class="col-md-6">';
foreach ($columns['column_2'] as $content) {
echo $content;
}
foreach ($columns['column_2'] as $content) {
echo $content;
}
echo '</div>';
} else {
echo '<div id="column2" class="col-md-6">';

@ -26,7 +26,7 @@ unset($_SESSION['this_section']); //for hmtl editor repository
$actions = array('listing', 'store_user_block', 'disable_block');
$action = 'listing';
if (isset($_GET['action']) && in_array($_GET['action'], $actions)) {
$action = $_GET['action'];
$action = $_GET['action'];
}
// load styles from dashboard plugins
@ -37,7 +37,7 @@ $htmlHeadXtra[] = $dashboar_plugin_styles;
$dashboard_controller = new DashboardController();
if (isset($_GET['path'])) {
$path = $_GET['path'];
$path = $_GET['path'];
}
// distpacher actions to controller

@ -12,9 +12,9 @@ api_block_anonymous_users();
$tool_name = get_lang('Dashboard');
// Header
Display :: display_header($tool_name);
Display::display_header($tool_name);
// Display
echo $content;
Display :: display_footer();
Display::display_footer();

@ -59,17 +59,16 @@ $(window).load(function () {
$is_certificate_mode = false;
if (isset($_REQUEST['certificate']) && $_REQUEST['certificate'] == 'true') {
$is_certificate_mode = true;
$is_certificate_mode = true;
}
if ($is_certificate_mode) {
$nameTools = get_lang('CreateCertificate');
$nameTools = get_lang('CreateCertificate');
} else {
$nameTools = get_lang('CreateDocument');
$nameTools = get_lang('CreateDocument');
}
/* Constants and variables */
$doc_table = Database::get_course_table(TABLE_DOCUMENT);
$course_id = api_get_course_int_id();
$courseCode = api_get_course_id();
@ -122,26 +121,33 @@ if (empty($document_data)) {
// Please, do not modify this dirname formatting
if (strstr($dir, '..')) {
$dir = '/';
$dir = '/';
}
if ($dir[0] == '.') {
$dir = substr($dir, 1);
$dir = substr($dir, 1);
}
if ($dir[0] != '/') {
$dir = '/'.$dir;
$dir = '/'.$dir;
}
if ($dir[strlen($dir) - 1] != '/') {
$dir .= '/';
$dir .= '/';
}
if ($is_certificate_mode) {
$document_id = DocumentManager::get_document_id(api_get_course_info(), '/certificates');
$document_data = DocumentManager::get_document_data_by_id($document_id, api_get_course_id(), true);
$folder_id = $document_data['id'];
$dir = '/certificates/';
$document_id = DocumentManager::get_document_id(
api_get_course_info(),
'/certificates'
);
$document_data = DocumentManager::get_document_data_by_id(
$document_id,
api_get_course_id(),
true
);
$folder_id = $document_data['id'];
$dir = '/certificates/';
}
$doc_tree = explode('/', $dir);
@ -152,7 +158,7 @@ if (api_is_in_group()) {
// Level correction for group documents.
if (!empty($group_properties['directory'])) {
$count_dir = $count_dir > 0 ? $count_dir - 1 : 0;
$count_dir = $count_dir > 0 ? $count_dir - 1 : 0;
}
}
$relative_url = '';
@ -165,7 +171,6 @@ if ($relative_url == '') {
}
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$editorConfig = array(
'ToolbarSet' => ($is_allowed_to_edit ? 'Documents' : 'DocumentsStudent'),
'Width' => '100%',
@ -240,6 +245,7 @@ if (isset($group_properties)) {
$select_cat = isset($_GET['selectcat']) ? intval($_GET['selectcat']) : null;
$curDirPath = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null;
// Create a new form
$form = new FormValidator(
'create_document',
@ -292,14 +298,29 @@ function document_exists($filename)
// Add group to the form
if ($is_certificate_mode) {
$form->addText('title', get_lang('CertificateName'), true, array('cols-size' => [2, 10, 0], 'autofocus'));
$form->addText(
'title',
get_lang('CertificateName'),
true,
array('cols-size' => [2, 10, 0], 'autofocus')
);
} else {
$form->addText('title', get_lang('Title'), true, array('cols-size' => [2, 10, 0], 'autofocus'));
$form->addText(
'title',
get_lang('Title'),
true,
array('cols-size' => [2, 10, 0], 'autofocus')
);
}
// Show read-only box only in groups
if (!empty($groupId)) {
$group[] = $form->createElement('checkbox', 'readonly', '', get_lang('ReadOnly'));
$group[] = $form->createElement(
'checkbox',
'readonly',
'',
get_lang('ReadOnly')
);
}
$form->addRule('title', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('title', get_lang('FileExists'), 'callback', 'document_exists');
@ -349,7 +370,9 @@ if (!$is_certificate_mode &&
continue;
}
// Admin setting for Hide/Show the folders of all users
if (api_get_setting('show_users_folders') == 'false' && (strstr($val, '/shared_folder') || strstr($val, 'shared_folder_session_'))) {
if (api_get_setting('show_users_folders') == 'false' &&
(strstr($val, '/shared_folder') || strstr($val, 'shared_folder_session_'))
) {
continue;
}
// Admin setting for Hide/Show Default folders to all users
@ -368,7 +391,7 @@ if (!$is_certificate_mode &&
$sql = "SELECT * FROM $doc_table
WHERE
c_id = $course_id AND
filetype='folder' AND
filetype = 'folder' AND
path IN ('".$folder_sql."')";
$res = Database::query($sql);
$folder_titles = array();
@ -506,7 +529,6 @@ if ($form->validate()) {
}
if ($fp = @fopen($filepath.$filename.'.'.$extension, 'w')) {
$content = str_replace(
api_get_path(WEB_COURSE_PATH),
api_get_configuration_value('url_append').api_get_path(REL_COURSE_PATH),
@ -617,17 +639,17 @@ if ($form->validate()) {
// link back to the documents overview
if ($is_certificate_mode) {
$actionsLeft = '<a href="document.php?certificate=true&id='.$folder_id.'&selectcat='.Security::remove_XSS($_GET['selectcat']).'">'.
Display::return_icon('back.png', get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview'), '', ICON_SIZE_MEDIUM).'</a>';
$actionsLeft .= '<a id="hide_bar_template" href="#" role="button">'.
Display::return_icon('expand.png', get_lang('Back'), array('id'=>'expand'), ICON_SIZE_MEDIUM).Display::return_icon('contract.png', get_lang('Back'), array('id'=>'contract', 'class'=>'hide'), ICON_SIZE_MEDIUM).'</a>';
} else {
$actionsLeft = '<a href="document.php?curdirpath='.Security::remove_XSS($dir).'">'.
Display::return_icon('back.png', get_lang('Back').' '.get_lang('To').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>';
$actionsLeft .= '<a id="hide_bar_template" href="#" role="button">'.
Display::return_icon('expand.png', get_lang('Expand'), array('id'=>'expand'), ICON_SIZE_MEDIUM).
Display::return_icon('contract.png', get_lang('Collapse'), array('id'=>'contract', 'class'=>'hide'), ICON_SIZE_MEDIUM).'</a>';
}
$actionsLeft = '<a href="document.php?certificate=true&id='.$folder_id.'&selectcat='.Security::remove_XSS($_GET['selectcat']).'">'.
Display::return_icon('back.png', get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview'), '', ICON_SIZE_MEDIUM).'</a>';
$actionsLeft .= '<a id="hide_bar_template" href="#" role="button">'.
Display::return_icon('expand.png', get_lang('Back'), array('id'=>'expand'), ICON_SIZE_MEDIUM).Display::return_icon('contract.png', get_lang('Back'), array('id'=>'contract', 'class'=>'hide'), ICON_SIZE_MEDIUM).'</a>';
} else {
$actionsLeft = '<a href="document.php?curdirpath='.Security::remove_XSS($dir).'">'.
Display::return_icon('back.png', get_lang('Back').' '.get_lang('To').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>';
$actionsLeft .= '<a id="hide_bar_template" href="#" role="button">'.
Display::return_icon('expand.png', get_lang('Expand'), array('id'=>'expand'), ICON_SIZE_MEDIUM).
Display::return_icon('contract.png', get_lang('Collapse'), array('id'=>'contract', 'class'=>'hide'), ICON_SIZE_MEDIUM).'</a>';
}
echo $toolbar = Display::toolbarAction('actions-documents', array($actionsLeft));

@ -621,8 +621,6 @@ class Dropbox_Person
{
$course_id = api_get_course_int_id();
$_course = api_get_course_info();
$dropbox_cnf = getDropboxConf();
$id = intval($id);
// index check
@ -684,7 +682,6 @@ class Dropbox_Person
*/
public function filter_received_work($type, $value)
{
$dropbox_cnf = getDropboxConf();
$new_received_work = array();
$mailId = get_mail_id_base();
foreach ($this->receivedWork as $work) {

@ -77,7 +77,6 @@ if (user_can_download_file($_GET['id'], api_get_user_id())) {
}
/* ERROR IF NOT ALLOWED TO DOWNLOAD */
if (!$allowed_to_download) {
api_not_allowed(
true,
@ -97,7 +96,8 @@ if (!$allowed_to_download) {
$path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/dropbox/'.$work->filename;
if (!Security::check_abs_path(
$path,
api_get_path(SYS_COURSE_PATH).$_course['path'].'/dropbox/')
api_get_path(SYS_COURSE_PATH).$_course['path'].'/dropbox/'
)
) {
api_not_allowed(true);
}

@ -214,8 +214,8 @@ function display_move_form(
/**
* This function moves a file to a different category
*
* @param $id the id of the file we are moving
* @param $target the id of the folder we are moving to
* @param int $id the id of the file we are moving
* @param int $target the id of the folder we are moving to
* @param string $part are we moving a received file or a sent file?
*
* @return string string

@ -103,13 +103,13 @@ Version 1.4 (Yannick Warnier)
* @author René Haentjens, severalcontributions <rene.haentjens@UGent.be>
* @author Roan Embrechts, virtual course support
* @author Patrick Cool <patrick.cool@UGent.be>
Chamilo Config Settings (AWACS)
Refactoring
tool introduction
folders
download file / folder (download icon)
same action on multiple documents
extended feedback
* Chamilo Config Settings (AWACS)
* Refactoring
* tool introduction
* folders
* download file / folder (download icon)
* same action on multiple documents
* extended feedback
* @package chamilo.dropbox
*/
@ -326,15 +326,15 @@ if ($view == 'received') {
'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?'.api_get_cidreq(),
'name' => get_lang('Dropbox', ''),
);
$nameTools = get_lang('ReceivedFiles');
$nameTools = get_lang('ReceivedFiles');
if ($action == 'addreceivedcategory') {
if ($action == 'addreceivedcategory') {
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?view=received&'.api_get_cidreq(),
'name' => get_lang('ReceivedFiles'),
);
$nameTools = get_lang('AddNewCategory');
}
$nameTools = get_lang('AddNewCategory');
}
}
if ($view == 'sent' || empty($view)) {
@ -369,7 +369,6 @@ if ($view == 'sent' || empty($view)) {
}
/* HEADER & TITLE */
if (isset($origin) && $origin == 'learnpath') {
$htmlHeadXtra[] = $javascript;
Display::display_reduced_header($nameTools, 'Dropbox');

@ -6,7 +6,9 @@ require_once 'dropbox_init.inc.php';
$last_access = '';
// get the last time the user accessed the tool
if (isset($_SESSION[$_course['id']]) && $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] == '') {
if (isset($_SESSION[$_course['id']]) &&
$_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] == ''
) {
$last_access = get_last_tool_access(TOOL_DROPBOX);
$_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] = $last_access;
} else {
@ -119,7 +121,15 @@ if (($action == 'movesent' || $action == 'movereceived') && isset($_GET['move_id
);
}
if (isset($_POST['do_move'])) {
echo Display::return_message(store_move($_POST['id'], $_POST['move_target'], $_POST['part']), 'confirm');
$result = store_move(
$_POST['id'],
$_POST['move_target'],
$_POST['part']
);
echo Display::return_message(
$result,
'confirm'
);
}
// Delete a file
@ -127,7 +137,11 @@ if (($action == 'deletereceivedfile' || $action == 'deletesentfile') && isset($_
if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
api_not_allowed();
}
$dropboxfile = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor);
$dropboxfile = new Dropbox_Person(
api_get_user_id(),
$is_courseAdmin,
$is_courseTutor
);
if ($action == 'deletereceivedfile') {
$dropboxfile->deleteReceivedWork($_GET['id']);
$message = get_lang('ReceivedFileDeleted');
@ -164,7 +178,6 @@ if (!isset($_POST['feedback']) && (
}
// Store Feedback
if (isset($_POST['feedback'])) {
if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
api_not_allowed();
@ -243,7 +256,6 @@ if ($action != 'add') {
}
/* Menu Sent */
if (api_get_session_id() == 0) {
echo '<div class="actions">';
if ($view_dropbox_category_sent != 0) {
@ -374,11 +386,11 @@ if ($action != 'add') {
)
) {
$new_icon = '&nbsp;'.Display::return_icon(
'new_dropbox_message.png',
get_lang('New'),
'',
ICON_SIZE_SMALL
);
'new_dropbox_message.png',
get_lang('New'),
'',
ICON_SIZE_SMALL
);
}
}
@ -409,7 +421,6 @@ if ($action != 'add') {
'</a>';
// This is a hack to have an additional row in a sortable table
if ($action == 'viewfeedback' && isset($_GET['id']) && is_numeric($_GET['id']) && $dropbox_file->id == $_GET['id']) {
$action_icons .= "</td></tr>"; // Ending the normal row of the sortable table
$action_icons .= '<tr>
@ -496,7 +507,6 @@ if ($action != 'add') {
}
/* SENT FILES */
if (!$view || $view == 'sent' || !$showSentReceivedTabs) {
// This is for the categories
if (isset($viewSentCategory) && $viewSentCategory != '') {

@ -45,13 +45,18 @@ if (Database::num_rows($result)) {
$file['filename'],
api_convert_and_format_date($file['upload_date']),
Display::url(
get_lang('Recover'), api_get_self().'?recover_id='.$file['id'],
get_lang('Recover'),
api_get_self().'?recover_id='.$file['id'],
array('class' => 'btn btn-default')
)
);
}
}
$headers = array(get_lang('FileName'), get_lang('UploadedDate'), get_lang('Action'));
$headers = array(
get_lang('FileName'),
get_lang('UploadedDate'),
get_lang('Action')
);
echo Display::table($headers, $rows);
}
Display::display_footer();

@ -8530,12 +8530,14 @@ class SessionManager
}
/**
* @param \Chamilo\CoreBundle\Entity\Course $course
* @param \Chamilo\CoreBundle\Entity\Session $session
* @param Course $course
* @param Session $session
* @return int
*/
public static function getCountUsersInCourseSession(Course $course, Session $session)
{
public static function getCountUsersInCourseSession(
Course $course,
Session $session
) {
return Database::getManager()
->createQuery("
SELECT COUNT(scu)

@ -22,7 +22,6 @@ if (!$object->allowed()) {
api_not_allowed(true);
}
$sessionUrl = api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.$sessionId;
$htmlHeadXtra[] = api_get_jqgrid_js();

Loading…
Cancel
Save