/** * Displays the view * * @param string $tpl The name of the template file to parse * @return void */ public function display($tpl = null) { Html::behavior('framework'); \Hubzero\Document\Assets::addComponentStylesheet('com_languages', 'overrider.css'); \Hubzero\Document\Assets::addComponentScript('com_languages', 'overrider.js'); //Document::addStyleSheet(Request::root().'media/overrider/css/overrider.css'); //Document::addScript(Request::root().'media/overrider/js/overrider.js'); $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); // Check for errors if (count($errors = $this->get('Errors'))) { throw new Exception(implode("\n", $errors)); return; } // Check whether the cache has to be refreshed $cached_time = User::getState('com_languages.overrides.cachedtime.' . $this->state->get('filter.client') . '.' . $this->state->get('filter.language'), 0); if (time() - $cached_time > 60 * 5) { $this->state->set('cache_expired', true); } // Add strings for translations in Javascript JText::script('COM_LANGUAGES_VIEW_OVERRIDE_NO_RESULTS'); JText::script('COM_LANGUAGES_VIEW_OVERRIDE_REQUEST_ERROR'); $this->addToolbar(); parent::display($tpl); }
function display($tpl = null) { $user = User::getRoot(); // If this is an auth_link account update, carry on, otherwise raise an error if (!is_object($user) || !array_key_exists('auth_link_id', $user) || !is_numeric($user->get('username')) || !$user->get('username') < 0) { App::abort('405', 'Method not allowed'); return; } // Get and add the js and extra css to the page \Hubzero\Document\Assets::addComponentStylesheet('com_users', 'link.css'); \Hubzero\Document\Assets::addComponentStylesheet('com_users', 'providers.css'); \Hubzero\Document\Assets::addComponentScript('com_users', 'link'); // Import a few things jimport('joomla.user.helper'); // Look up a few things $hzal = \Hubzero\Auth\Link::find_by_id($user->get("auth_link_id")); $hzad = \Hubzero\Auth\Domain::find_by_id($hzal->auth_domain_id); $plugins = Plugin::byType('authentication'); // Get the display name for the current plugin being used Plugin::import('authentication', $hzad->authenticator); $plugin = Plugin::byType('authentication', $hzad->authenticator); $pparams = new \Hubzero\Config\Registry($plugin->params); $refl = new ReflectionClass("plgAuthentication{$plugin->name}"); $display_name = $pparams->get('display_name', $refl->hasMethod('onGetLinkDescription') ? $refl->getMethod('onGetLinkDescription')->invoke(NULL) : ucfirst($plugin->name)); // Look for conflicts - first check in the hub accounts $profile_conflicts = \Hubzero\User\Profile\Helper::find_by_email($hzal->email); // Now check the auth_link table $link_conflicts = \Hubzero\Auth\Link::find_by_email($hzal->email, array($hzad->id)); $conflict = array(); if ($profile_conflicts) { foreach ($profile_conflicts as $p) { $user_id = JUserHelper::getUserId($p); $juser = User::getInstance($user_id); $auth_link = \Hubzero\Auth\Link::find_by_user_id($juser->id); $dname = is_object($auth_link) && $auth_link->auth_domain_name ? $auth_link->auth_domain_name : 'hubzero'; $conflict[] = array("auth_domain_name" => $dname, "name" => $juser->name, "email" => $juser->email); } } if ($link_conflicts) { foreach ($link_conflicts as $l) { $juser = User::getInstance($l['user_id']); $conflict[] = array("auth_domain_name" => $l['auth_domain_name'], "name" => $juser->name, "email" => $l['email']); } } // Make sure we don't somehow have any duplicate conflicts $conflict = array_map("unserialize", array_unique(array_map("serialize", $conflict))); // @TODO: Could also check for high probability of name matches??? // Get the site name $sitename = Config::get('sitename'); // Assign variables to the view $this->assign('hzal', $hzal); $this->assign('hzad', $hzad); $this->assign('plugins', $plugins); $this->assign('display_name', $display_name); $this->assign('conflict', $conflict); $this->assign('sitename', $sitename); $this->assignref('juser', $user); parent::display($tpl); }
/** * Initiate the editor. Push scripts to document if needed * * @return string */ public function onInit() { if ($this->_pushscripts) { \Hubzero\Document\Assets::addPluginStylesheet('editors', $this->_name); \Hubzero\Document\Assets::addPluginScript('editors', $this->_name); $this->_pushscripts = false; } return ''; }
/** * Gets the link domain name * * @param int $adid The auth domain ID * @return string **/ public static function getLinkIndicator($adid) { \Hubzero\Document\Assets::addPluginStylesheet('authentication', 'shibboleth', 'shibboleth.css'); $dbh = App::get('db'); $dbh->setQuery('SELECT domain FROM `#__auth_domain` WHERE id = ' . (int) $adid); // oops ... hopefully not reachable if (!($idp = $dbh->loadResult()) || !($label = self::getInstitutionByEntityId($idp, 'label'))) { return 'InCommon'; } return $label; }
function display($tpl = null) { Html::behavior('framework', true); \Hubzero\Document\Assets::addComponentScript('com_media', 'popup-imagemanager.js'); \Hubzero\Document\Assets::addComponentStylesheet('com_media', 'popup-imagemanager.css'); // Display form for FTP credentials? // Don't set them here, as there are other functions called before this one if there is any file write operation $ftp = !JClientHelper::hasCredentials('ftp'); $this->session = App::get('session'); $this->config = Component::params('com_media'); $this->state = $this->get('state'); $this->folderList = $this->get('folderList'); $this->require_ftp = $ftp; parent::display($tpl); }
function display($tpl = null) { // Assign variables to the view $authenticator = \Request::getWord('authenticator', false); \Hubzero\Document\Assets::addComponentStylesheet('com_user', 'login.css'); // Get the site name $sitename = \Config::get('sitename'); // Get the display name for the current plugin being used $plugin = Plugin::byType('authentication', $authenticator); $pparams = new \Hubzero\Config\Registry($plugin->params); $display_name = $pparams->get('display_name', ucfirst($plugin->name)); $this->assign('authenticator', $authenticator); $this->assign('sitename', $sitename); $this->assign('display_name', $display_name); parent::display($tpl); }
function display($tpl = null) { // Do not allow cache App::get('response')->headers->set('Cache-Control', 'no-cache', false); App::get('response')->headers->set('Pragma', 'no-cache'); \Hubzero\Document\Assets::addComponentStylesheet('com_media', 'popup-imagelist.css'); Document::addScriptDeclaration("var ImageManager = window.parent.ImageManager;"); $images = $this->get('images'); $folders = $this->get('folders'); $state = $this->get('state'); $this->baseURL = COM_MEDIA_BASEURL; $this->assignRef('images', $images); $this->assignRef('folders', $folders); $this->assignRef('state', $state); parent::display($tpl); }
function display($tpl = null) { $config = Component::params('com_media'); $style = Request::getState('media.list.layout', 'layout', 'thumbs', 'word'); Document::setBuffer($this->loadTemplate('navigation'), 'modules', 'submenu'); Html::behavior('framework', true); \Hubzero\Document\Assets::addComponentScript('com_media', 'mediamanager.js'); \Hubzero\Document\Assets::addComponentStylesheet('com_media', 'mediamanager.css'); Html::behavior('modal'); Document::addScriptDeclaration("\n\t\tjQuery(document).ready(function(\$){\n\t\t\tdocument.preview = \$.fancybox;\n\t\t});"); Html::asset('script', 'system/jquery.treeview.js', true, true, false, false); Html::asset('stylesheet', 'system/jquery.treeview.css', array(), true); if (Lang::isRTL()) { Html::asset('stylesheet', 'media/jquery.treeview_rtl.css', array(), true); } if (DIRECTORY_SEPARATOR == '\\') { $base = str_replace(DIRECTORY_SEPARATOR, "\\\\", COM_MEDIA_BASE); } else { $base = COM_MEDIA_BASE; } $js = "\n\t\t\tvar basepath = '" . $base . "';\n\t\t\tvar viewstyle = '" . $style . "';\n\t\t"; Document::addScriptDeclaration($js); // Display form for FTP credentials? // Don't set them here, as there are other functions called before this one if there is any file write operation $ftp = !JClientHelper::hasCredentials('ftp'); $session = App::get('session'); $state = $this->get('state'); $this->assignRef('session', $session); $this->assignRef('config', $config); $this->assignRef('state', $state); $this->require_ftp = $ftp; $this->folders_id = ' id="media-tree"'; $this->folders = $this->get('folderTree'); // Set the toolbar $this->addToolbar(); parent::display($tpl); echo Html::behavior('keepalive'); }
function display($tpl = null) { // Do not allow cache App::get('response')->headers->set('Cache-Control', 'no-cache', false); App::get('response')->headers->set('Pragma', 'no-cache'); $style = Request::getState('media.list.layout', 'layout', 'thumbs', 'word'); Html::behavior('framework', true); //Document::addStyleSheet('../media/media/css/medialist-'.$style.'.css'); \Hubzero\Document\Assets::addComponentStylesheet('com_media', 'medialist-' . $style . '.css'); if (Lang::isRTL()) { //Document::addStyleSheet('../media/media/css/medialist-'.$style.'_rtl.css'); \Hubzero\Document\Assets::addComponentStylesheet('com_media', 'medialist-' . $style . '_rtl.css'); } Document::addScriptDeclaration("\n\t\tjQuery(document).ready(function(\$){\n\t\t\twindow.parent.document.updateUploader();\n\t\t\t\$('a.img-preview').on('click', function(e) {\n\t\t\t\te.preventDefault();\n\t\t\t\twindow.top.document.preview.open(\$(this).attr('href'));\n\t\t\t});\n\t\t});"); $images = $this->get('images'); $documents = $this->get('documents'); $folders = $this->get('folders'); $state = $this->get('state'); // Check for invalid folder name if (empty($state->folder)) { $dirname = Request::getVar('folder', '', '', 'string'); if (!empty($dirname)) { $dirname = htmlspecialchars($dirname, ENT_COMPAT, 'UTF-8'); if (Lang::hasKey('COM_MEDIA_ERROR_UNABLE_TO_BROWSE_FOLDER_WARNDIRNAME')) { throw new Exception(Lang::txt('COM_MEDIA_ERROR_UNABLE_TO_BROWSE_FOLDER_WARNDIRNAME', $dirname), 100); } else { throw new Exception(sprintf('Unable to browse: %s. Directory name must only contain alphanumeric characters and no spaces.', $dirname), 100); } } } $this->baseURL = Request::root(); $this->assignRef('images', $images); $this->assignRef('documents', $documents); $this->assignRef('folders', $folders); $this->assignRef('state', $state); parent::display($tpl); }
/** * Include needed libraries and push scripts and CSS to the document * * @return void */ public static function documents() { \Hubzero\Document\Assets::addComponentStylesheet('com_events'); }
<!--[if (gt IE 9)|!(IE)]><!--> <html dir="<?php echo $this->direction; ?> " lang="<?php echo $this->language; ?> " class="<?php echo implode(' ', $cls); ?> "> <!--<![endif]--> <head> <meta name="viewport" content="width=device-width" /> <!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge" /><![endif]--> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo \Hubzero\Document\Assets::getSystemStylesheet(); ?> " /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo $this->baseurl; ?> /templates/<?php echo $this->template; ?> /css/main.css" /> <link rel="stylesheet" type="text/css" media="print" href="<?php echo $this->baseurl; ?> /templates/<?php echo $this->template; ?>
/** * Retrieve records for items tagged with specific tags * * @param array $tags Tags to match records against * @param mixed $limit SQL record limit * @param integer $limitstart SQL record limit start * @param string $sort The field to sort records by * @param mixed $areas An array or string of areas that should retrieve records * @return mixed Returns integer when counting records, array when retrieving records */ public function onTagView($tags, $limit = 0, $limitstart = 0, $sort = '', $areas = null) { $response = array('name' => $this->_name, 'title' => Lang::txt('PLG_TAGS_RESOURCES'), 'total' => 0, 'results' => null, 'sql' => '', 'children' => array()); $database = App::get('db'); $rt = new \Components\Resources\Tables\Type($database); foreach ($rt->getMajorTypes() as $category) { $response['children'][$category->alias] = array('name' => $category->alias, 'title' => $category->type, 'total' => 0, 'results' => null, 'sql' => '', 'id' => $category->id); } if (empty($tags)) { return $response; } $ids = array(); foreach ($tags as $tag) { $ids[] = $tag->get('id'); } // Instantiate some needed objects $rr = new \Components\Resources\Tables\Resource($database); // Build query $filters = array(); $filters['tags'] = $ids; $filters['now'] = Date::toSql(); $filters['sortby'] = $sort ? $sort : 'ranking'; $filters['authorized'] = false; $filters['usergroups'] = \Hubzero\User\Helper::getGroups(User::get('id'), 'all'); $filters['select'] = 'count'; foreach ($response['children'] as $k => $t) { $filters['type'] = $t['id']; // Execute a count query for each area/category $database->setQuery($this->_buildPluginQuery($filters)); $response['children'][$k]['total'] = $database->loadResult(); $response['total'] += $response['children'][$k]['total']; } if ($areas && ($areas == $response['name'] || isset($response['children'][$areas]))) { // Push some CSS and JS to the tmeplate that may be needed \Hubzero\Document\Assets::addComponentStylesheet('com_resources'); $filters['select'] = 'records'; $filters['limit'] = $limit; $filters['limitstart'] = $limitstart; $filters['sortby'] = $sort ? $sort : 'date'; // Check the area of return. If we are returning results for a specific area/category // we'll need to modify the query a bit if (isset($response['children'][$areas])) { $filters['type'] = $response['children'][$areas]['id']; $database->setQuery($this->_buildPluginQuery($filters)); $response['children'][$areas]['results'] = $database->loadObjectList(); } else { unset($filters['type']); $database->setQuery($this->_buildPluginQuery($filters)); $response['results'] = $database->loadObjectList(); } } else { $filters['select'] = 'records'; $filters['limit'] = 'all'; $filters['limitstart'] = $limitstart; $filters['sortby'] = $sort ? $sort : 'date'; // Check the area of return. If we are returning results for a specific area/category // we'll need to modify the query a bit if (isset($response['children'][$areas])) { $filters['type'] = $response['children'][$areas]['id']; $response['children'][$key]['sql'] = $this->_buildPluginQuery($filters); } else { unset($filters['type']); $response['sql'] = $this->_buildPluginQuery($filters); } } return $response; }
/** * Get module contents * * @return void */ public function display() { header("Cache-Control: cache, must-revalidate"); header("Pragma: public"); $image_dir = trim($this->params->get('image_dir', 'site/slideshow'), DS); $alias = $this->params->get('alias', ''); $height = $this->params->get('height', '350'); $width = $this->params->get('width', '600'); $timerdelay = $this->params->get('timerdelay', '10000'); $transitiontype = $this->params->get('transitiontype', 'fade'); $random = $this->params->get('random', 0); $xmlPrefix = "slideshow-data"; $noflash = $this->params->get('stype', 0); $noflash_link = $this->params->get('noflash_link', ''); $swffile = rtrim(Assets::getModuleImage($this->module->module, 'banner' . $width . 'x' . $height . '.swf'), '.swf'); // check for directory if (!is_dir(PATH_APP . DS . $image_dir)) { if (!Filesystem::makeDirectory(PATH_APP . DS . $image_dir)) { echo Lang::txt('failed to create image directory') . ' ' . $image_dir; $noflash = 1; } else { // use default images for this time $image_dir = 'modules/mod_slideshow/assets/flash/images'; } } $images = array(); $files = Filesystem::files(PATH_APP . DS . $image_dir, '.', false, true, array()); if (count($files) == 0) { $image_dir = 'modules/mod_slideshow/assets/flash/images'; } $noflash_file = 'modules/mod_slideshow/assets/flash/images/default_' . $width . 'x' . $height . '.jpg'; if (is_dir(PATH_APP . DS . $image_dir)) { $files = Filesystem::files(PATH_APP . DS . $image_dir, '.', false, true); foreach ($files as $file) { if (preg_match("/bmp|gif|jpg|png|swf\$/i", strtolower($file))) { $images[] = $file; } } if (count($images) > 0) { // pick a random image to display if flash doesn't work $noflash_file = $image_dir . DS . $images[array_rand($images)]; if ($random) { // shuffle array shuffle($images); } // start xml output if (!$noflash) { $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; $xml .= " <slideshow>\n"; $xml .= " <timerdelay>" . $timerdelay . "</timerdelay>\n"; $xml .= " <transition>" . $transitiontype . "</transition>\n"; for ($i = 0, $n = count($images); $i < $n; $i++) { if (is_file(PATH_APP . DS . $image_dir . DS . $images[$i])) { $xml .= " <image src='" . htmlspecialchars($image_dir . DS . $images[$i]) . "' />\n"; } } $xml .= " </slideshow>\n"; $xmlpath = PATH_APP . DS . $this->homedir . DS . $xmlPrefix; $xmlpath .= $alias ? '-' . $alias : ''; $xmlpath .= '.xml'; $fh = fopen($xmlpath, "w"); fwrite($fh, utf8_encode($xml)); fclose($fh); } } else { $noflash = 1; } } else { $noflash = 1; } if (!$noflash) { $this->js(); $this->js('HUB.ModSlideshow.src="' . $swffile . '"; HUB.ModSlideshow.alias="' . $alias . '"; HUB.ModSlideshow.height="' . $height . '"; HUB.ModSlideshow.width="' . $width . '"'); } $this->width = $width; $this->height = $height; $this->noflash_link = $noflash_link; $this->noflash_file = $noflash_file; require $this->getLayoutPath(); }
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * HUBzero is a registered trademark of Purdue University. * * @package hubzero-cms * @author Sam Wilson <*****@*****.**> * @copyright Copyright 2005-2015 HUBzero Foundation, LLC. * @license http://opensource.org/licenses/MIT MIT */ \Hubzero\Document\Assets::addComponentStylesheet('com_users', 'factors.css'); ?> <header id="content-header"> <h2><?php echo Lang::txt('COM_USERS_FACTOR_VERIFICATION'); ?> </h2> </header> <section class="main section factors"> <?php foreach ($this->factors as $factor) { ?> <div class="factor-wrap"> <div class="factor">
/** * Browser within publications NEW * * @return string */ public function select() { // Incoming $props = Request::getVar('p', ''); $ajax = Request::getInt('ajax', 0); $pid = Request::getInt('pid', 0); $vid = Request::getInt('vid', 0); $filter = urldecode(Request::getVar('filter', '')); // Parse props for curation $parts = explode('-', $props); $block = isset($parts[0]) ? $parts[0] : 'content'; $step = isset($parts[1]) && is_numeric($parts[1]) && $parts[1] > 0 ? $parts[1] : 1; $element = isset($parts[2]) && is_numeric($parts[2]) && $parts[2] > 0 ? $parts[2] : 1; // Provisioned project? $prov = $this->model->isProvisioned() ? 1 : 0; // Output HTML $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'databases', 'name' => 'selector', 'layout' => 'default')); $view->publication = new \Components\Publications\Models\Publication($pid, NULL, $vid); // On error if (!$view->publication->exists()) { // Output error $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'files', 'name' => 'error')); $view->title = ''; $view->option = $this->_option; $view->setError(Lang::txt('PLG_PROJECTS_DATABASES_SELECTOR_ERROR_NO_PUBID')); return $view->loadTemplate(); } $view->publication->attachments(); // Get curation model $view->publication->setCuration(); // Make sure block exists, else use default $view->publication->_curationModel->setBlock($block, $step); // Set pub assoc and load curation $view->publication->_curationModel->setPubAssoc($view->publication); \Hubzero\Document\Assets::addPluginStylesheet('projects', 'databases', 'selector'); if (!$ajax) { \Hubzero\Document\Assets::addPluginStylesheet('projects', 'publications', 'selector'); } $view->option = $this->_option; $view->database = $this->_database; $view->model = $this->model; $view->uid = $this->_uid; $view->ajax = $ajax; $view->element = $element; $view->block = $block; $view->step = $step; $view->props = $props; $view->filter = $filter; // Get databases to choose from $objPD = new \Components\Projects\Tables\Database($this->_database); $view->items = $objPD->getItems($this->model->get('id'), array()); // Get messages and errors if ($this->getError()) { $view->setError($this->getError()); } $arr = array('html' => $view->loadTemplate(), 'metadata' => '', 'msg' => '', 'referer' => ''); return $arr; }
" class="<?php echo implode(' ', $cls); ?> "> <!--<![endif]--> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width" /> <!-- <meta http-equiv="X-UA-Compatible" content="IE=edge" /> Doesn't validate... --> <title><?php echo $config->getValue('config.sitename') . ' - ' . (in_array($this->error->getCode(), array(404, 403, 500)) ? $this->error->getCode() : 500); ?> </title> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo \Hubzero\Document\Assets::getSystemStylesheet(array('fontcons', 'reset', 'columns', 'notifications')); /* reset MUST come before all others except fontcons */ ?> " /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo $this->baseurl; ?> /templates/<?php echo $this->template; ?> /css/main.css" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo $this->baseurl; ?> /templates/<?php echo $this->template;
/** * Build panel content * * @return string HTML */ public function buildContent($pub = NULL, $viewname = 'edit') { $name = $viewname == 'freeze' || $viewname == 'curator' ? 'freeze' : 'draft'; // Get selector styles \Hubzero\Document\Assets::addPluginStylesheet('projects', 'publications', 'selector'); // Output HTML $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'publications', 'name' => $name, 'layout' => 'license')); $view->pub = $pub; $view->manifest = $this->_manifest; $view->step = $this->_blockId; $objL = new \Components\Publications\Tables\License($this->_parent->_db); // Get selected license $view->license = $objL->getPubLicense($pub->version_id); $view->selections = $objL->getBlockLicenses($this->_manifest, $view->license); // Pre-select single available license if (!$view->license && count($view->selections) == 1) { $view->license = new \Components\Publications\Tables\License($this->_parent->_db); $view->license->load($view->selections[0]->id); } if ($this->getError()) { $view->setError($this->getError()); } return $view->loadTemplate(); }
<h4><?php echo Lang::txt('COM_PUBLICATIONS_ABSTRACT'); ?> </h4> <div class="pub-content"> <?php echo $description; ?> </div> <?php // List all content? $listAll = isset($this->publication->_curationModel->_manifest->params->list_all) ? $this->publication->_curationModel->_manifest->params->list_all : 0; $listLabel = isset($this->publication->_curationModel->_manifest->params->list_label) ? $this->publication->_curationModel->_manifest->params->list_label : Lang::txt('COM_PUBLICATIONS_CONTENT_LIST'); // Add plugin style \Hubzero\Document\Assets::addPluginStylesheet('publications', 'supportingdocs'); if ($listAll) { // Get elements in primary and supporting role $prime = $this->publication->_curationModel->getElements(1); $second = $this->publication->_curationModel->getElements(2); $elements = array_merge($prime, $second); // Get attachment type model $attModel = new \Components\Publications\Models\Attachments($this->database); if ($elements) { $append = NULL; // Get file path $path = \Components\Publications\Helpers\Html::buildPubPath($this->publication->id, $this->publication->version_id, $webpath, '', 1); $licFile = $path . DS . 'LICENSE.txt'; if (file_exists($licFile)) { $licenseUrl = Route::url('index.php?option=' . $this->option . '&id=' . $this->publication->id . '&task=license' . '&v=' . $this->publication->version_id); $append = '<li><a href="' . $licenseUrl . '" class="license-terms play" rel="external">' . Lang::txt('COM_PUBLICATIONS_LICENSE_TERMS') . '</a></li>';
* @package hubzero-cms * @author Sam Wilson <*****@*****.**> * @copyright Copyright 2005-2015 HUBzero Foundation, LLC. * @license http://opensource.org/licenses/MIT MIT */ use Components\Time\Models\Hub; use Components\Time\Models\Task; // No direct access. defined('_HZEXEC_') or die; $this->css()->css('overview')->css('fullcalendar')->js('overview'); \Hubzero\Document\Assets::addSystemStylesheet('jquery.fancyselect.css'); \Hubzero\Document\Assets::addSystemScript('flot/jquery.flot.min'); \Hubzero\Document\Assets::addSystemScript('flot/jquery.flot.pie.min'); \Hubzero\Document\Assets::addSystemScript('jquery.fancyselect'); \Hubzero\Document\Assets::addSystemScript('moment.min'); \Hubzero\Document\Assets::addSystemScript('jquery.fullcalendar.min'); HTML::behavior('core'); $utc = Date::of('now'); $now = Date::of($utc)->toLocal(Lang::txt('g:00a')); $then = Date::of(strtotime($now . ' + 1 hour'))->toLocal(Lang::txt('g:00a')); $start = Date::of($utc)->toLocal(Lang::txt('G')); $end = Date::of(strtotime($now . ' + 1 hour'))->toLocal(Lang::txt('G')); ?> <header id="content-header"> <h2><?php echo $this->title; ?> </h2> </header>
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * HUBzero is a registered trademark of Purdue University. * * @package hubzero-cms * @author Sam Wilson <*****@*****.**> * @copyright Copyright 2005-2015 HUBzero Foundation, LLC. * @license http://opensource.org/licenses/MIT MIT */ // No direct access defined('_HZEXEC_') or die; $db = App::get('db'); $this->css('prerequisites'); $this->js('prerequisites'); \Hubzero\Document\Assets::AddSystemScript('handlebars'); $includeForm = isset($this->includeForm) ? $this->includeForm : true; $prereqs = new \Components\Courses\Tables\Prerequisites($db); $existing = $prereqs->loadAllByScope($this->scope, $this->scope_id, $this->section_id); $ids = array(); foreach ($existing as $value) { $ids[] = $value->requisite_id; } ?> <script id="prerequisite-item" type="text/x-handlebars-template"> <li class="requisite-list-item" data-id="{{id}}"> <div class="requisite-item clearfix"> <div class="remove-requisite" data-delete-id="{{req_id}}">x</div> <div class="requisite-item-title">{{title}}</div> </div>
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * HUBzero is a registered trademark of Purdue University. * * @package hubzero-cms * @author Sam Wilson <*****@*****.**> * @copyright Copyright 2005-2015 HUBzero Foundation, LLC. * @license http://opensource.org/licenses/MIT MIT */ // No direct access defined('_HZEXEC_') or die; \Hubzero\Document\Assets::addSystemScript('jquery.fancyselect.min'); \Hubzero\Document\Assets::addSystemStylesheet('jquery.fancyselect.css'); // Get our asset model $asset = new \Components\Courses\Models\Asset(Request::getInt('asset_id', null)); $asset->set('section_id', $this->course->offering()->section()->get('id')); // Get the asset groups $assetgroups = array(); $assets = array(); foreach ($this->course->offering()->units() as $unit) { foreach ($unit->assetgroups() as $agt) { foreach ($agt->children() as $ag) { $assetgroups[] = array('id' => $ag->get('id'), 'title' => $ag->get('title')); foreach ($ag->assets() as $a) { if ($a->isPublished()) { $a->set('longTitle', $unit->get('title') . ' - ' . $ag->get('title') . ' - ' . $a->get('title')); $assets[] = $a; }
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * HUBzero is a registered trademark of Purdue University. * * @package hubzero-cms * @author Sam Wilson <*****@*****.**> * @copyright Copyright 2005-2015 HUBzero Foundation, LLC. * @license http://opensource.org/licenses/MIT MIT */ // No direct access. defined('_HZEXEC_') or die; \Hubzero\Document\Assets::addComponentStylesheet('com_users', 'userconsent.css'); ?> <header id="content-header"> <h2><?php echo Lang::txt('COM_USERS_USERCONSENT'); ?> </h2> </header> <section class="section consent"> <div><?php echo Lang::txt('COM_USERS_USERCONSENT_MESSAGE'); ?> </div>
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * HUBzero is a registered trademark of Purdue University. * * @package hubzero-cms * @author Sam Wilson <*****@*****.**> * @copyright Copyright 2005-2015 HUBzero Foundation, LLC. * @license http://opensource.org/licenses/MIT MIT */ // No direct access. defined('_HZEXEC_') or die; \Hubzero\Document\Assets::addSystemStylesheet('jquery.ui.css'); $this->css()->css($this->controller); ?> <div class="com_time_permissions_container"> <form action="<?php echo Route::url('index.php?option=' . $this->option . '&controller=' . $this->controller); ?> " method="POST"> <div class="permissions-box"> <fieldset class="permissions"> <?php echo $this->permissions->label; ?> <?php echo $this->permissions->input;
/** * Include needed libraries and push scripts and CSS to the document * * @return void */ public static function documents() { // Push some CSS and JS to the tmeplate that may be needed \Hubzero\Document\Assets::addComponentStylesheet('com_resources'); include_once PATH_CORE . DS . 'components' . DS . 'com_resources' . DS . 'helpers' . DS . 'helper.php'; include_once PATH_CORE . DS . 'components' . DS . 'com_resources' . DS . 'helpers' . DS . 'usage.php'; }
/** * Build panel content * * @return string HTML */ public function buildContent($pub = NULL, $viewname = 'edit') { $name = $viewname == 'freeze' || $viewname == 'curator' ? 'freeze' : 'draft'; // Get selector styles \Hubzero\Document\Assets::addPluginStylesheet('projects', 'team', 'selector'); // Output HTML $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'publications', 'name' => $name, 'layout' => 'authors')); // Get authors if (!isset($pub->_authors)) { $pAuthors = new \Components\Publications\Tables\Author($this->_parent->_db); $pub->_authors = $pAuthors->getAuthors($pub->version_id); $pub->_submitter = $pAuthors->getSubmitter($pub->version_id, $pub->created_by); } // Get creator groups $view->groups = \Hubzero\User\Helper::getGroups($pub->_project->get('owned_by_user'), 'members', 1); $view->pub = $pub; $view->manifest = $this->_manifest; $view->step = $this->_blockId; // Get team members $objO = new \Components\Projects\Tables\Owner($this->_parent->_db); $view->teamids = $objO->getIds($pub->_project->get('id'), 'all', 0, 0); if ($this->getError()) { $view->setError($this->getError()); } return $view->loadTemplate(); }
/** * Build panel content * * @return string HTML */ public function buildContent($pub = NULL, $viewname = 'edit') { $name = $viewname == 'freeze' || $viewname == 'curator' ? 'freeze' : 'draft'; // Output HTML $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'publications', 'name' => $name, 'layout' => 'citations')); // Get selector styles \Hubzero\Document\Assets::addPluginStylesheet('projects', 'links'); \Hubzero\Document\Assets::addPluginStylesheet('projects', 'files', 'selector'); \Hubzero\Document\Assets::addPluginStylesheet('projects', 'publications', 'selector'); if (!isset($pub->_citations)) { // Get citations for this publication $c = new \Components\Citations\Tables\Citation($this->_parent->_db); $pub->_citations = $c->getCitations('publication', $pub->id); } $view->pub = $pub; $view->manifest = $this->_manifest; $view->step = $this->_blockId; if ($this->getError()) { $view->setError($this->getError()); } return $view->loadTemplate(); }
/** * Assign curation * * @return void */ public function assignTask() { // Incoming $pid = $this->_id ? $this->_id : Request::getInt('id', 0); $vid = Request::getInt('vid', 0); $owner = Request::getInt('owner', 0); $confirm = Request::getInt('confirm', 0); $ajax = Request::getInt('ajax', 0); // Load publication model $this->_pub = new \Components\Publications\Models\Publication($pid, NULL, $vid); if (!$this->_pub->exists()) { if ($ajax) { $this->view = new \Hubzero\Component\View(array('name' => 'error', 'layout' => 'restricted')); $this->view->error = Lang::txt('COM_PUBLICATIONS_CURATION_ERROR_LOAD'); $this->view->title = $this->title; $this->view->display(); return; } throw new Exception(Lang::txt('COM_PUBLICATIONS_CURATION_ERROR_LOAD'), 404); } if (!$this->_pub->access('curator')) { if ($ajax) { $this->view = new \Hubzero\Component\View(array('name' => 'error', 'layout' => 'restricted')); $this->view->error = Lang::txt('COM_PUBLICATIONS_CURATION_ERROR_UNAUTHORIZED'); $this->view->title = $this->title; $this->view->display(); return; } throw new Exception(Lang::txt('COM_PUBLICATIONS_CURATION_ERROR_UNAUTHORIZED'), 403); } // Perform assignment if ($confirm) { $previousOwner = $this->_pub->version->get('curator'); $selected = Request::getInt('selected', 0); // Make sure owner profile exists if ($owner) { $ownerProfile = User::getInstance($owner); if (!$ownerProfile) { $this->setError(Lang::txt('COM_PUBLICATIONS_CURATION_ERROR_ASSIGN_PROFILE')); } } elseif ($selected && Request::getVar('owner', '')) { $owner = $selected; } // Assign if (!$this->getError()) { $this->_pub->version->set('curator', $owner); if (!$this->_pub->version->store()) { $this->setError(Lang::txt('COM_PUBLICATIONS_CURATION_ASSIGN_FAILED')); } // Notify curator if ($owner && $owner != $previousOwner) { $item = '"' . html_entity_decode($this->_pub->version->title) . '"'; $item .= ' v.' . $this->_pub->version->version_label . ' '; $item = htmlentities($item, ENT_QUOTES, "UTF-8"); $message = Lang::txt('COM_PUBLICATIONS_CURATION_EMAIL_ASSIGNED') . ' ' . $item . "\n" . "\n"; $message .= Lang::txt('COM_PUBLICATIONS_CURATION_EMAIL_ASSIGNED_CURATE') . ' ' . rtrim(Request::base(), DS) . DS . trim(Route::url($this->_pub->link('curate')), DS) . "\n" . "\n"; $message .= Lang::txt('COM_PUBLICATIONS_CURATION_EMAIL_ASSIGNED_PREVIEW') . ' ' . rtrim(Request::base(), DS) . DS . trim(Route::url($this->_pub->link('version')), DS); Helpers\Html::notify($this->_pub, array($owner), Lang::txt('COM_PUBLICATIONS_CURATION_EMAIL_ASSIGNED_SUBJECT'), $message); } // Log assignment in history if (!$this->getError() && $owner != $previousOwner) { $obj = new Tables\CurationHistory($this->database); if (!empty($ownerProfile)) { $changelog = '<p>Curation assigned to ' . $ownerProfile->get('name') . ' (' . $ownerProfile->get('username') . ')</p>'; } else { $changelog = '<p>Curator assignment was removed</p>'; } // Create new record $obj->publication_version_id = $this->_pub->version->id; $obj->created = Date::toSql(); $obj->created_by = User::get('id'); $obj->changelog = $changelog; $obj->curator = 1; $obj->newstatus = $this->_pub->version->state; $obj->oldstatus = $this->_pub->version->state; $obj->store(); } } } else { if (!$ajax) { // Set page title $this->_buildTitle(); // Set the pathway $this->_buildPathway(); // Add plugin style \Hubzero\Document\Assets::addPluginStylesheet('projects', 'publications', 'curation.css'); } $this->view->pub = $this->_pub; $this->view->title = $this->_title; $this->view->option = $this->_option; $this->view->ajax = $ajax; $this->view->display(); return; } $message = $this->getError() ? $this->getError() : Lang::txt('COM_PUBLICATIONS_CURATION_SUCCESS_ASSIGNED'); $class = $this->getError() ? 'error' : 'success'; // Redirect to main listing App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=curation'), $message, $class); return; }
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * HUBzero is a registered trademark of Purdue University. * * @package hubzero-cms * @copyright Copyright 2005-2015 HUBzero Foundation, LLC. * @license http://opensource.org/licenses/MIT MIT */ // No direct access. defined('_HZEXEC_') or die; Html::behavior('framework'); \Hubzero\Document\Assets::addSystemScript('jquery.datetimepicker'); \Hubzero\Document\Assets::addSystemStylesheet('jquery.datetimepicker.css'); $text = $this->task == 'edit' ? Lang::txt('JACTION_EDIT') : Lang::txt('JACTION_CREATE'); $mwdb = \Components\Tools\Helpers\Utils::getMWDBO(); $zones = with(new \Components\Tools\Tables\Zones($mwdb))->find('all'); ?> <script> function submitbutton(pressbutton) { var form = document.adminForm; if (pressbutton == 'cancel') { submitform(pressbutton); return; }
/** * Push styles and scripts to the document * * @return void */ public static function documents() { \Hubzero\Document\Assets::addComponentStylesheet('com_resources'); \Hubzero\Document\Assets::addComponentScript('com_resources'); include_once PATH_CORE . DS . 'components' . DS . 'com_resources' . DS . 'helpers' . DS . 'helper.php'; include_once PATH_CORE . DS . 'components' . DS . 'com_resources' . DS . 'helpers' . DS . 'usage.php'; }
/** * Return data on a resource view (this will be some form of HTML) * * @param object $publication Current publication * @param string $option Name of the component * @param array $areas Active area(s) * @param string $rtrn Data to be returned * @param string $version Version name * @param boolean $extended Whether or not to show panel * @return array */ public function onPublication($publication, $option, $areas, $rtrn = 'all', $version = 'default', $extended = true) { $arr = array('html' => '', 'metadata' => ''); // Check if our area is in the array of areas we want to return results for if (is_array($areas)) { if (!array_intersect($areas, $this->onPublicationAreas($publication)) && !array_intersect($areas, array_keys($this->onPublicationAreas($publication)))) { $rtrn = 'metadata'; } } if (!$publication->_category->_params->get('plg_usage') || !$extended) { return $arr; } // Temporarily display only metadata $rtrn = 'metadata'; // Check if we have a needed database table $database = App::get('db'); $tables = $database->getTableList(); $table = $database->getPrefix() . 'publication_stats'; if ($publication->alias) { $url = Route::url('index.php?option=' . $option . '&alias=' . $publication->alias . '&active=usage'); } else { $url = Route::url('index.php?option=' . $option . '&id=' . $publication->id . '&active=usage'); } if (!in_array($table, $tables)) { $arr['html'] = '<p class="error">' . Lang::txt('PLG_PUBLICATION_USAGE_MISSING_TABLE') . '</p>'; $arr['metadata'] = '<p class="usage"><a href="' . $url . '">' . Lang::txt('PLG_PUBLICATION_USAGE_DETAILED') . '</a></p>'; return $arr; } // Get/set some variables $dthis = Request::getVar('dthis', date('Y') . '-' . date('m')); $period = Request::getInt('period', $this->params->get('period', 14)); include_once PATH_CORE . DS . 'components' . DS . $option . DS . 'tables' . DS . 'stats.php'; require_once PATH_CORE . DS . 'components' . DS . $option . DS . 'helpers' . DS . 'usage.php'; $stats = new \Components\Publications\Tables\Stats($database); $stats->loadStats($publication->id, $period, $dthis); // Are we returning HTML? if ($rtrn == 'all' || $rtrn == 'html') { \Hubzero\Document\Assets::addComponentStylesheet('com_usage'); // Instantiate a view $view = new \Hubzero\Plugin\View(array('folder' => 'publications', 'element' => 'usage', 'name' => 'browse')); // Get usage helper $view->helper = new \Components\Publications\Helpers\Usage($database, $publication->id, $publication->base); // Pass the view some info $view->option = $option; $view->publication = $publication; $view->stats = $stats; $view->chart_path = $this->params->get('chart_path', ''); $view->map_path = $this->params->get('map_path', ''); $view->dthis = $dthis; $view->period = $period; if ($this->getError()) { $view->setError($this->getError()); } // Return the output $arr['html'] = $view->loadTemplate(); } if ($rtrn == 'metadata') { $stats->loadStats($publication->id, $period); if ($stats->users) { $action = $publication->base == 'files' ? '%s download(s)' : '%s view(s)'; $arr['metadata'] = '<p class="usage">' . Lang::txt('%s user(s)', $stats->users); $arr['metadata'] .= $stats->downloads ? ' | ' . Lang::txt($action, $stats->downloads) : ''; $arr['metadata'] .= '</p>'; } } if ($stats->users) { $arr['name'] = 'usage'; $arr['count'] = $stats->users; } return $arr; }