/** * Modify the page's head items, if desired * @param object $head_items * @return void */ public function modify_head_items($head_items, $event = null) { $media = $this->bundle->media_works($event); if (!empty($media)) { if (count($media) > 1) { $head_items->add_javascript(JQUERY_URL, true); $head_items->add_javascript(REASON_HTTP_BASE_PATH . 'modules/events/media_gallery.js'); } $head_items->add_stylesheet(REASON_HTTP_BASE_PATH . 'modules/events/media_gallery.css'); } }
/** task dispatcher * * this routine decides what to do and calls the appropriate workhorse routine(s) * * @return bool TRUE on success, FALSE otherwise * @todo check permissions (ACL) to prevent leaking a private area path to anonymous visitors? */ function run() { global $CFG; $m = ' '; // 1 -- determine the directory path and other configuration information $this->get_snapshots_configuration($this->node_id); // 2A -- get a list of available files from $snapshots_path $this->snapshots = $this->get_snapshots($this->snapshots_path); $snapshots_count = sizeof($this->snapshots); // 2B -- if there are none we bail out but DO show the header+introduction if ($snapshots_count <= 0) { if (!empty($this->header)) { $this->theme->add_content($m . html_tag('h3', array('class' => 'snapshots_header'), $this->header)); } if (!empty($this->introduction)) { $this->theme->add_content($m . html_tag('div', array('class' => 'snapshots_introduction'), $this->introduction)); } $msg = t('no_snapshots_available', $this->domain); $this->theme->add_message($msg); $this->theme->add_content($m . '<h3>' . $msg . '</h3>'); return TRUE; } // 3A -- get ready to do some real work $stylesheet = 'program/modules/snapshots/snapshots.css'; $this->theme->add_stylesheet($stylesheet); $this->javascript_include_once('/modules/snapshots/slideshow.js'); $this->javascript_add_img_array(); // 3B -- what do they want? $snapshot_index = get_parameter_int('snapshot', NULL); if (!is_null($snapshot_index) && 0 < $snapshot_index && $snapshot_index <= $snapshots_count) { $retval = $this->view_snapshot($snapshot_index); } else { // if no specific image was specified, we allow the user to choose the variant, // while using the value from the database as a (sensible) default. $variant = get_parameter_int('variant', $this->variant); switch ($variant) { case 1: $retval = $this->view_thumbnails(); break; case 2: $retval = $this->view_snapshot(1); break; case 3: $retval = $this->view_slideshow(); break; default: $retval = $this->view_thumbnails(); // shouldn't happen break; } } return $retval; }
/** * @deprecated method should be called on the head_items object */ function add_stylesheet( $url, $media = '', $add_to_top = false, $wrapper = array('before'=>'','after'=>'') ) { $this->head_items->add_stylesheet( $url, $media, $add_to_top, $wrapper ); }
/** construct a FileManager object (called from /program/main_admin.php) * * This initialises the FileManager, checks user permissions and * finally dispatches the tasks. If the specified task is not * recognised, the default task TASK_LIST_DIRECTORY is executed. * * Note that many commands act on the directory contained in the * SESSION-variable current_directory. * * @param object &$output collects the html output * @param string $job indicates the mode: filemanager, filebrowser (FCKEditor) or imagebrowser (FCKEditor) * @return void results are returned as output in $this->output * @todo a nice filter for JOB_IMAGEBROWSER and also an alternative user interface for browsing/selecting images */ function FileManager(&$output, $job = JOB_FILEMANAGER) { global $USER, $CFG; $this->output =& $output; $this->job = $job; // Prepare lists of allowed filename extensions for browsing/uploading and set show thumbnail flag switch ($this->job) { case JOB_FILEBROWSER: $this->output->add_stylesheet($CFG->progwww_short . '/styles/admin_no_navigation.css'); $this->show_thumbnails = TRUE; $this->ext_allow_upload = $this->ext_allow_browse = $this->allowed_extensions($CFG->filemanager_files); break; case JOB_IMAGEBROWSER: $this->output->add_stylesheet($CFG->progwww_short . '/styles/admin_no_navigation.css'); $this->show_thumbnails = TRUE; $this->ext_allow_upload = $this->ext_allow_browse = $this->allowed_extensions($CFG->filemanager_images); break; case JOB_FLASHBROWSER: $this->output->add_stylesheet($CFG->progwww_short . '/styles/admin_no_navigation.css'); $this->show_thumbnails = TRUE; $this->ext_allow_upload = $this->ext_allow_browse = $this->allowed_extensions($CFG->filemanager_flash); break; case JOB_FILEMANAGER: $allowed_extensions_list = $CFG->filemanager_files; $this->show_thumbnails = FALSE; $this->ext_allow_upload = $this->allowed_extensions($CFG->filemanager_files); $this->ext_allow_browse = TRUE; break; default: logger(sprintf('%s.%s(): weird job \'%s\' so no allowed file extensions at all, sorry about that', __CLASS__, __FUNCTION__, $this->job)); $this->show_thumbnails = FALSE; $this->ext_allow_upload = FALSE; $this->ext_allow_browse = FALSE; break; } $this->output->set_helptopic('filemanager'); $this->areas = get_area_records(); $this->usergroups = get_user_groups($USER->user_id); $this->sort = SORTBY_FILE_ASC; // Make absolutely sure we do have a valid working directory (default to the user's 'My Files') if (!isset($_SESSION['current_directory'])) { $_SESSION['current_directory'] = '/users/' . $USER->path; } elseif (($_SESSION['current_directory'] = $this->valid_path($_SESSION['current_directory'])) === FALSE) { $_SESSION['current_directory'] = '/users/' . $USER->path; } $this->current_directory =& $_SESSION['current_directory']; $task = get_parameter_string('task', TASK_LIST_DIRECTORY); switch ($task) { case TASK_LIST_DIRECTORY: $this->task_list_directory(); break; case TASK_CHANGE_DIRECTORY: $this->task_change_directory(); break; case TASK_PREVIEW_FILE: $this->task_preview_file(); break; case TASK_REMOVE_FILE: $this->task_remove_file(); break; case TASK_REMOVE_DIRECTORY: $this->task_remove_directory(); break; case TASK_REMOVE_MULTIPLE_FILES: $this->task_remove_multiple_files(); break; case TASK_ADD_FILE: $this->task_add_file(); break; case TASK_ADD_DIRECTORY: $this->task_add_directory(); break; default: $s = utf8_strlen($task) <= 50 ? $task : utf8_substr($task, 0, 44) . ' (...)'; $message = t('task_unknown', 'admin', array('{TASK}' => htmlspecialchars($s))); $this->output->add_message($message); logger(__FUNCTION__ . '(): unknown task: ' . htmlspecialchars($s)); $this->task_list_directory(); break; } }
/** * Modify the page's head items, if desired * @param object $head_items * @return void */ public function modify_head_items($head_items) { $head_items->add_stylesheet(REASON_HTTP_BASE_PATH . 'modules/events/responsive.css'); }