/** * Delete a file or a directory (and its whole content) * * @param - $filePath (String) - the path of file or directory to delete * @return - boolean - true if the delete succeed * boolean - false otherwise. */ function claro_delete_file($filePath) { if (is_file($filePath)) { return unlink($filePath); } elseif (is_dir($filePath)) { $dirHandle = @opendir($filePath); if (!$dirHandle) { function_exists('claro_html_debug_backtrace') && pushClaroMessage(claro_html_debug_backtrace()); return false; } $removableFileList = array(); while (false !== ($file = readdir($dirHandle))) { if ($file == '.' || $file == '..') { continue; } $removableFileList[] = $filePath . '/' . $file; } closedir($dirHandle); // impossible to test, closedir return void ... if (sizeof($removableFileList) > 0) { foreach ($removableFileList as $thisFile) { if (!claro_delete_file($thisFile)) { return false; } } } clearstatcache(); if (is_writable($filePath)) { return @rmdir($filePath); } else { function_exists('claro_html_debug_backtrace') && pushClaroMessage(claro_html_debug_backtrace()); return false; } } // end elseif is_dir() }
/** * convert a duration in seconds to a human readable duration * @author Sebastien Piraux <*****@*****.**> * @param integer duration time in seconds to convert to a human readable duration */ function claro_disp_duration($duration) { pushClaroMessage((function_exists('claro_html_debug_backtrace') ? claro_html_debug_backtrace() : 'claro_html_debug_backtrace() not defined') . 'claro_ disp _duration() is deprecated , use claro_ html _duration()', 'error'); return claro_html_duration($duration); }
/** * Return tool listbfor the current course * * @param string or null $dataName property name, or null to keep an array of all properties * @author Christophe Gesche <*****@*****.**> * @return array of all value or value of given property name */ function claro_get_current_course_tool_list_data($dataName = null) { $ctl = get_init('_courseToolList'); if (is_null($dataName)) { return $ctl; } elseif (is_array($ctl) && array_key_exists($dataName, $ctl)) { return $ctl[$dataName]; } else { pushClaroMessage(claro_html_debug_backtrace(), 'error'); pushClaroMessage(' -' . $dataName . '- does not exist for course tool list data', 'error'); return null; } }
/** * Display a date at localized format * @copyright (c) 2001-2011, Universite catholique de Louvain (UCL) * @param formatOfDate see http://www.php.net/manual/en/function.strftime.php for syntax to use for this string I suggest to use the format you can find in trad4all.inc.php files * @param timestamp timestamp of date to format */ function claro_disp_localised_date($formatOfDate, $timestamp = -1) { pushClaroMessage((function_exists('claro_html_debug_backtrace') ? claro_html_debug_backtrace() : 'claro_html_debug_backtrace() not defined') . 'claro_ disp _localised_date() is deprecated , use claro_ html _localised_date()', 'error'); return claro_html_localised_date($formatOfDate, $timestamp); }
/** * build htmlstream for input form of a time * * @param string $hourFieldName attribute name of the input Hour * @param string $minuteFieldName attribute name of the input minutes * @param string $unixDate unix timestamp of date to display * * @return string html stream to output input tag for an hour * * @author S�bastien Piraux <*****@*****.**> * */ function claro_disp_time_form($hourFieldName, $minuteFieldName, $unixDate = 0) { pushClaroMessage((function_exists('claro_html_debug_backtrace') ? claro_html_debug_backtrace() : 'claro_html_debug_backtrace() not defined') . 'claro_disp_time_form() is deprecated , use claro_html_time_form()', 'error'); return claro_html_time_form($hourFieldName, $minuteFieldName, $unixDate); }
/** * * * @copyright (c) 2001-2011, Universite catholique de Louvain (UCL) * @param string $curDirPath current path in the documents tree navugation * @return string breadcrumb trail */ function claro_disp_document_breadcrumb($curDirPath) { pushClaroMessage((function_exists('claro_html_debug_backtrace') ? claro_html_debug_backtrace() : 'claro_html_debug_backtrace() not defined') . 'claro_disp_document_breadcrumb is deprecated , use claro_html_document_breadcrumb', 'error'); return claro_html_document_breadcrumb($curDirPath); }
/** * CLAROLINE mySQL query wrapper. It also provides a debug display which works * when the CLARO_DEBUG_MODE constant flag is set to on (true) * * @copyright (c) 2001-2011, Universite catholique de Louvain (UCL) * @author Christophe Gesch√© <*****@*****.**> * @param string $sqlQuery - the sql query * @param handler $dbHandler - optional * @return handler - the result handler * @deprecated since Claroline 1.9, use Claroline::getDatabase() and new classes * in database/database.lib.php instead */ function claro_sql_query($sqlQuery, $dbHandler = '#') { if (claro_debug_mode() && get_conf('CLARO_PROFILE_SQL', false)) { $start = microtime(); } if ($dbHandler == '#') { $resultHandler = @mysql_query($sqlQuery); } else { $resultHandler = @mysql_query($sqlQuery, $dbHandler); } if (claro_debug_mode() && get_conf('CLARO_PROFILE_SQL', false)) { static $queryCounter = 1; $duration = microtime() - $start; $info = 'execution time : ' . ($duration > 0.001 ? '<b>' . round($duration, 4) . '</b>' : '<0.001') . 'µs'; // $info = ( $dbHandler == '#') ? mysql_info() : mysql_info($dbHandler); // $info .= ': affected rows :' . (( $dbHandler == '#') ? mysql_affected_rows() : mysql_affected_rows($dbHandler)); $info .= ': affected rows :' . claro_sql_affected_rows(); pushClaroMessage('<br />Query counter : <b>' . $queryCounter++ . '</b> : ' . $info . '<br />' . '<code><span class="sqlcode">' . nl2br($sqlQuery) . '</span></code>', claro_sql_errno() ? 'error' : 'sqlinfo'); } if (claro_debug_mode() && claro_sql_errno()) { echo '<hr size="1" noshade>' . claro_sql_errno() . ' : ' . claro_sql_error() . '<br>' . '<pre style="color:red">' . $sqlQuery . '</pre>' . (function_exists('claro_html_debug_backtrace') ? claro_html_debug_backtrace() : '') . '<hr size="1" noshade>'; } return $resultHandler; }
/** * Display options to switch between student view and course manager view * This function is mainly used by the claro_init_banner.inc.php file * The display mode command will only be displayed if * claro_set_tool_view_mode(true) has been previously called. * This will affect the return value of claro_is_allowed_to_edit() function. * It will ten return false as the user is a simple student. * * @author Roan Embrechts * @author Hugues Peeters * @param string - $viewModeRequested. * For now it can be 'STUDENT' or 'COURSE_ADMIN' * @see claro_is_allowed_to_edit() * @see claro_is_display_mode_available() * @see claro_set_display_mode_available() * @see claro_get_tool_view_mode() * @see claro_set_tool_view_mode() * @return true; */ function claro_disp_tool_view_option($viewModeRequested = false) { pushClaroMessage((function_exists('claro_html_debug_backtrace') ? claro_html_debug_backtrace() : 'claro_html_debug_backtrace() not defined') . 'claro_disp_tool_view_option is deprecated , use claro_html_tool_view_option', 'error'); return claro_html_tool_view_option($viewModeRequested); }
function claro_disp_monthly_calendar($agendaItemList, $month, $year, $weekdaynames, $monthName) { pushClaroMessage((function_exists('claro_html_debug_backtrace') ? claro_html_debug_backtrace() : 'claro_html_debug_backtrace() not defined') . 'claro_disp_monthly_calendar is deprecated , use claro_html_monthly_calendar', 'error'); return claro_html_monthly_calendar($agendaItemList, $month, $year, $weekdaynames, $monthName); }