示例#1
0
 /**
  * Hook for after routing application
  * 
  * @return  void
  */
 public function onAfterRoute()
 {
     if (!App::isAdmin() && !App::isSite()) {
         return;
     }
     $client = 'Site';
     if (App::isAdmin()) {
         $client = 'Admin';
         return;
     }
     // Check if active for this client (Site|Admin)
     if (!$this->params->get('activate' . $client) || Request::getVar('format') == 'pdf') {
         return;
     }
     Html::behavior('framework');
     if ($this->params->get('jqueryui')) {
         Html::behavior('framework', true);
     }
     if ($this->params->get('jqueryfb')) {
         Html::behavior('modal');
     }
     if ($this->params->get('noconflict' . $client)) {
         Document::addScript(Request::root(true) . '/core/assets/js/jquery.noconflict.js');
     }
 }
示例#2
0
 /**
  * Method to handle the onInitEditor event.
  *  - Initialises the Editor
  *
  * @return  string JavaScript Initialization string
  */
 public function onInit()
 {
     // add ckeditor stylesheet
     $this->css();
     // add ckeditor
     Document::addScript(str_replace('/administrator', '', Request::base(true)) . '/' . $this->_basePath . 'ckeditor.js');
     Document::addScript(str_replace('/administrator', '', Request::base(true)) . '/' . $this->_basePath . 'adapters/jquery.js');
 }
示例#3
0
 protected function getInput()
 {
     Document::addScript('/core/plugins/authentication/shibboleth/assets/js/admin.js');
     Document::addStyleSheet('/core/plugins/authentication/shibboleth/assets/css/jquery-ui.css');
     Document::addStyleSheet('/core/plugins/authentication/shibboleth/assets/css/admin.css');
     $html = array();
     $a = function ($str) {
         return str_replace('"', '"', $str);
     };
     $val = json_decode($this->value, TRUE);
     $html[] = '<div class="shibboleth" data-iconify="' . $a(preg_replace('#^' . preg_quote(PATH_CORE) . '#', '', __FILE__)) . '">';
     $html[] = '<p class="xml-source"><label>Shibboleth ID provider configuration file: <input type="text" name="xmlPath" value="' . $a($val['xmlPath']) . '" /></label></p>';
     list($val['xmlRead'], $val['idps']) = self::getIdpList($val);
     $html[] = '<p class="info">Save your changes to retry loading ID providers from this file</p>';
     $html[] = '<input type="hidden" class="serialized" name="' . $this->name . '" value="' . $a(json_encode($val)) . '" />';
     $html[] = '</div>';
     // rest of the form is managed on the client side
     return implode("\n", $html);
 }
示例#4
0
 /**
  * Render content to group template
  *
  * @param    string
  */
 public function render()
 {
     // get stylehseet base & source
     $base = isset($this->params->base) ? strtolower($this->params->base) : 'uploads';
     $source = isset($this->params->source) ? trim($this->params->source) : null;
     // if we want base to be template,
     // shortcut to template/assets/css folder
     if ($base == 'template') {
         $base = 'template' . DS . 'assets' . DS . 'js';
     }
     // we must have a source
     if ($source === null) {
         return;
     }
     // get download path for source (serve up file)
     if ($path = $this->group->downloadLinkForPath($base, $source)) {
         // add stylsheet to document
         \Document::addScript($path);
     }
 }
 case 'store/category':
 case 'store/category/grid':
 case 'store/category/delete':
     $language->load('store/category');
     $loader->auto('store/category');
     $loader->auto('pagination');
     break;
 case 'store/category/insert':
 case 'store/category/update':
     $language->load('store/category');
     $loader->auto('store/category');
     $loader->auto('store/store');
     $loader->auto('localisation/language');
     $loader->auto('image');
     $document->addStyle(HTTP_CSS . "fancybox/jquery.fancybox.css", $rel = 'stylesheet', $media = 'screen');
     $document->addScript(HTTP_JS . "jquery/jquery.mousewheel-3.0.6.pack.js");
     $document->addScript(HTTP_JS . "jquery/fancybox/jquery.fancybox.pack.js");
     break;
 case 'store/category/products':
     $language->load('store/category');
     $loader->auto('store/category');
     $loader->auto('store/product');
     $loader->auto('image');
     break;
 case 'store/download':
 case 'store/download/grid':
 case 'store/download/delete':
     $language->load('store/download');
     $loader->auto('store/download');
     $loader->auto('pagination');
     break;
示例#6
0
				<div id="transcript-select"></div>
				<input type="text" id="transcript-search" placeholder="Search Transcript..." />
				<a href="javascript:void(0);" id="font-bigger"></a>
				<a href="javascript:void(0);" id="font-smaller"></a>
			</div>
			<div id="transcripts"></div>
		</div>
	</div>
<?php 
} elseif ($type == 'standalone') {
    ?>
	<?php 
    $path = DS . trim(substr(PATH_APP, strlen(PATH_ROOT)), DS) . DS . ltrim($path . DS . $this->model->get('url'), DS);
    $ext = strtolower(Filesystem::extension(PATH_ROOT . $path));
    Document::addStyleSheet('//releases.flowplayer.org/5.4.2/skin/minimalist.css');
    Document::addScript('//releases.flowplayer.org/5.4.2/flowplayer.min.js');
    ?>
	<div class="flowplayer">
		<video id="movie<?php 
    echo rand(0, 1000);
    ?>
" preload controls>
			<?php 
    switch ($ext) {
        case 'mov':
        case 'mp4':
        case 'm4v':
            echo '<source src="' . $path . '" type="video/mp4" />';
            break;
        case 'ogg':
        case 'ogv':
示例#7
0
 public function apipostTask()
 {
     $curl_result = '';
     $curl_err = '';
     //$url = ('https://dev26.hubzero.org/api/courses/premisRegister');
     //$url = ('https://dev26.hubzero.org/api/register/premisRegister');
     $url = 'https://dev.courses.purduenext.purdue.edu/api/register/premisRegister/';
     // !! $value = urlencode(stripslashes($value));
     $data['fName'] = 'Tolik';
     $data['lName'] = 'Dusik';
     $data['email'] = '*****@*****.**';
     $data['premisId'] = 'zero0';
     $data['premisEnrollmentId'] = 'primus0';
     //$data['casId'] = 'ishunko';
     $data['password'] = '******';
     $data['addRegistration'] = 'nanoscaletransistors';
     $data['dropRegistration'] = '';
     $req = 'ss=VezefruchASpEdruvE_RAmE4pesWep!A';
     foreach ($data as $key => $value) {
         $value = urlencode(stripslashes($value));
         $req .= "&{$key}={$value}";
     }
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded", "Content-Length: " . strlen($req)));
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_VERBOSE, 1);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
     curl_setopt($ch, CURLOPT_TIMEOUT, 30);
     $curl_result = @curl_exec($ch);
     $curl_err = curl_error($ch);
     curl_close($ch);
     print_r(json_decode($curl_result));
     //print_r($curl_result);
     die('+');
     Document::addScript(DS . 'components' . DS . 'com_cart' . DS . 'assets' . DS . 'js' . DS . 'test.js');
     $this->view->display();
 }
示例#8
0
 /**
  * Edit a type
  *
  * @return     void
  */
 public function editTask($row = null)
 {
     $this->view->setLayout('curation');
     if ($row) {
         $this->view->row = $row;
     } else {
         // Incoming (expecting an array)
         $id = Request::getVar('id', array(0));
         if (is_array($id)) {
             $id = $id[0];
         } else {
             $id = 0;
         }
         // Load the object
         $this->view->row = new \Components\Publications\Tables\MasterType($this->database);
         $this->view->row->load($id);
         $this->view->curation = new \Components\Publications\Models\Curation($this->view->row->curation);
         // Get blocks model
         $blocksModel = new \Components\Publications\Models\Blocks($this->database);
         // Get available blocks
         $this->view->blocks = $blocksModel->getBlocks('*', " WHERE status=1", " ORDER BY ordering, id");
     }
     // Set any errors
     if ($this->getError()) {
         $this->view->setError($this->getError());
     }
     $this->view->config = $this->config;
     // Get all active categories
     $objC = new \Components\Publications\Tables\Category($this->database);
     $this->view->cats = $objC->getCategories();
     // Push some styles to the template
     Document::addStyleSheet('components' . DS . $this->_option . DS . 'assets' . DS . 'css' . DS . 'publications.css');
     Document::addScript('components' . DS . $this->_option . DS . 'assets' . DS . 'js' . DS . 'curation.js');
     // Output the HTML
     $this->view->display();
 }
示例#9
0
 /**
  * Event call to return data for a specific project
  *
  * @param      object  $model           Project model
  * @param      string  $action			Plugin task
  * @param      string  $areas  			Plugins to return data
  * @return     array   Return array of html
  */
 public function onProject($model, $action = 'view', $areas = null)
 {
     $arr = array('html' => '', 'metadata' => '', 'message' => '', 'error' => '');
     // Get this area details
     $this->_area = $this->onProjectAreas();
     // Check if our area is in the array of areas we want to return results for
     if (is_array($areas)) {
         if (empty($this->_area) || !in_array($this->_area['name'], $areas)) {
             return;
         }
     }
     // Check authorization
     if ($model->exists() && !$model->access('member')) {
         return $arr;
     }
     // Model
     $this->model = $model;
     // Load component configs
     $this->_config = $model->config();
     $this->gitpath = $this->_config->get('gitpath', '/opt/local/bin/git');
     // Incoming
     $raw_op = Request::getInt('raw_op', 0);
     $action = $action ? $action : Request::getVar('action', 'list');
     // Get this area details
     $this->_area = $this->onProjectAreas();
     // Check if our area is in the array of areas we want to return results for
     if (is_array($areas)) {
         if (empty($this->_area) || !in_array($this->_area['name'], $areas)) {
             return $arr;
         }
     }
     $this->_database = App::get('db');
     $this->_uid = User::get('id');
     // Publishing?
     if ($action == 'browser') {
         return $this->browser();
     }
     if ($action == 'select') {
         return $this->select();
     }
     $act_func = 'act_' . $action;
     if (!method_exists($this, $act_func)) {
         if ($raw_op) {
             print json_encode(array('status' => 'success', 'data' => $table));
             exit;
         } else {
             $act_func = 'act_list';
         }
     }
     // detect CR as new line
     ini_set('auto_detect_line_endings', true);
     if ($raw_op) {
         $this->{$act_func}();
         exit;
     } else {
         Document::addScript('//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
         Document::addScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js');
         Document::addStyleSheet('//ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/themes/smoothness/jquery-ui.css');
         Document::addScript('/core/plugins/projects/databases/res/main.js');
         Document::addStyleSheet('/core/plugins/projects/databases/res/main.css');
         if (file_exists(__DIR__ . '/res/ds.' . $action . '.js')) {
             Document::addScript('/core/plugins/projects/databases/res/ds.' . $action . '.js');
         }
         if (file_exists(__DIR__ . '/res/ds.' . $action . '.css')) {
             Document::addStyleSheet('/core/plugins/projects/databases/res/ds.' . $action . '.css');
         }
         return $this->{$act_func}();
     }
 }
示例#10
0
// Check for errors
if ($this->getError()) {
    ?>
 <p class="error"><?php 
    echo $this->getError();
    ?>
</p>
<?php 
    return;
}
Document::addScript('/core/plugins/projects/databases/res/dataTables/jquery.dataTables.js');
Document::addStyleSheet('/core/plugins/projects/databases/res/dataTables/jquery.dataTables.css');
Document::addStyleSheet('/core/plugins/projects/databases/res/chosen/chosen.css');
Document::addScript('/core/plugins/projects/databases/res/chosen/chosen.jquery.js');
Document::addStyleSheet('/core/plugins/projects/databases/res/spectrum/spectrum.css');
Document::addScript('/core/plugins/projects/databases/res/spectrum/spectrum.js');
?>
<div id="plg-header">
<h3 class="databases c-header"><a href="<?php 
echo Route::url('index.php?option=' . $this->option . '&active=databases&alias=' . $this->model->get('alias'));
?>
"><?php 
echo Lang::txt('PLG_PROJECTS_DATABASES');
?>
</a> &raquo; <span class="indlist"><?php 
echo isset($this->db_id) ? Lang::txt('PLG_PROJECTS_DATABASES_UPDATE_DATABASE') : Lang::txt('PLG_PROJECTS_DATA_START');
?>
</span></h3>
</div>
<div id="prj-db-step-1" class="prj-db-step">
<?php 
示例#11
0
 /**
  * Generate macro output
  *
  * @return     string
  */
 public function render()
 {
     //get the args passed in
     $content = $this->args;
     // args will be null if the macro is called without parenthesis.
     if (!$content) {
         return '';
     }
     //declare the partial youtube embed url
     //$youtube_url = 'https://www.youtube.com/embed/';
     $video_url = '';
     //defaults
     $default_width = 640;
     $default_height = 380;
     $this->config = Component::params('com_wiki');
     if ($this->filepath != '') {
         $this->config->set('filepath', $this->filepath);
     }
     //split up the args
     $args = array_map('trim', explode(',', $content));
     $url = $args[0];
     // We need to reset thinsg in case of multiple usage of macro
     $this->attr = array();
     // Get single attributes
     // EX: [[Image(myimage.png, nolink, right)]]
     $argues = preg_replace_callback('/[, ](left|right|top|center|bottom|[0-9]+(px|%|em)?)(?:[, ]|$)/i', array(&$this, 'parseSingleAttribute'), $content);
     // Get quoted attribute/value pairs
     // EX: [[Image(myimage.png, desc="My description, contains, commas")]]
     $argues = preg_replace_callback('/[, ](alt|altimage|desc|title|width|height|align|border|longdesc|class|id|usemap|link)=(?:["\'])([^"]*)(?:["\'])/i', array(&$this, 'parseAttributeValuePair'), $content);
     // Get non-quoted attribute/value pairs
     // EX: [[Image(myimage.png, width=100)]]
     $argues = preg_replace_callback('/[, ](alt|altimage|desc|title|width|height|align|border|longdesc|class|id|usemap|link)=([^"\',]*)(?:[, ]|$)/i', array(&$this, 'parseAttributeValuePair'), $content);
     $width = isset($this->attr['width']) && $this->attr['width'] != '' ? $this->attr['width'] : $default_width;
     $height = isset($this->attr['height']) && $this->attr['height'] != '' ? $this->attr['height'] : $default_height;
     //check is user entered full youtube url or just Video Id
     if (!strstr($url, 'http')) {
         // File path, so assume local
         if (strstr($url, '/')) {
             $video_url = $url;
         } else {
             // Just a file name.
             $video_url = $this->_path($url);
             if (!file_exists($video_url)) {
                 $video_url = $this->_path($url, true);
                 if (!file_exists($video_url)) {
                     return '(video:' . $url . ' not found)' . $this->_path($url);
                 }
             }
         }
     } else {
         $video_url = $url;
     }
     // Default to local
     $type = 'local';
     // YouTube
     if (stristr($video_url, 'youtube')) {
         $type = 'youtube';
         if (strstr($video_url, '?')) {
             //split the string into two parts
             //uri and query string
             $full_url_parts = explode('?', $video_url);
             //split apart any key=>value pairs in query string
             $query_string_parts = explode("%26%2338%3B", urlencode($full_url_parts[1]));
             //foreach query string parts
             //explode at equals sign
             //check to see if v is the first part and if it is set the second part to the video id
             foreach ($query_string_parts as $qsp) {
                 $pairs_parts = explode("%3D", $qsp);
                 if ($pairs_parts[0] == 'v') {
                     $video_id = $pairs_parts[1];
                     break;
                 }
             }
             $video_url = 'https://www.youtube.com/embed/' . $video_id . '?wmode=transparent';
         }
     } else {
         if (stristr($video_url, 'vimeo')) {
             $type = 'vimeo';
         } else {
             if (stristr($video_url, 'blip')) {
                 $type = 'blip';
             } else {
                 if (stristr($video_url, 'kaltura')) {
                     $type = 'kaltura';
                     if (!stristr($video_url, 'iframeembed') && stristr($video_url, 'kmc')) {
                         $partner_id = 0;
                         $uiconf_id = 0;
                         $entry_id = 0;
                         $bits = explode('/', $video_url);
                         foreach ($bits as $i => $bit) {
                             if (strtolower($bit) == 'partner_id') {
                                 $partner_id = $bits[$i + 1];
                             }
                             switch (strtolower($bit)) {
                                 case 'partner_id':
                                     $partner_id = $bits[$i + 1];
                                     break;
                                 case 'uiconf_id':
                                     $uiconf_id = $bits[$i + 1];
                                     break;
                                 case 'entry_id':
                                     $entry_id = $bits[$i + 1];
                                     break;
                             }
                         }
                         $video_url = 'https://www.kaltura.com/p/' . $partner_id . '/sp/' . $partner_id . '00/embedIframeJs/uiconf_id/' . $uiconf_id . '/partner_id/' . $partner_id . '?iframeembed=true&playerId=movie' . rand(0, 1000) . '&entry_id=' . $entry_id . '&flashvars[autoPlay]=false';
                     }
                 }
             }
         }
     }
     // Create the embed
     // Local
     if ($type == 'local') {
         $ext = strtolower(Filesystem::extension($video_url));
         Document::addStyleSheet('//releases.flowplayer.org/5.4.2/skin/minimalist.css');
         Document::addScript('//releases.flowplayer.org/5.4.2/flowplayer.min.js');
         $html = '<div class="flowplayer" style="width: ' . $width . 'px; height: ' . $height . 'px;">';
         $html .= '<video id="movie' . rand(0, 1000) . '" width="' . $width . '" height="' . $height . '" preload controls>';
         switch ($ext) {
             case 'mov':
             case 'mp4':
             case 'm4v':
                 $html .= '<source src="' . $this->_link($url) . '" type="video/mp4" />';
                 break;
             case 'ogg':
             case 'ogv':
                 $html .= '<source src="' . $this->_link($url) . '" type="video/ogg" />';
                 break;
             case 'webm':
                 $html .= '<source src="' . $this->_link($url) . '" type="video/webm" />';
                 break;
         }
         $html .= '</video>';
         $html .= '</div>';
     } else {
         $html = '<iframe id="movie' . rand(0, 1000) . '" src="' . $video_url . '" width="' . $width . '" height="' . $height . '" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
     }
     // Return the emdeded youtube video
     return $html;
 }
示例#12
0
 /**
  * {xhub:include type="script" component="component" filename="filename"}
  * {xhub:include type="stylesheet" component="component" filename="filename"}
  *
  * @param   string  $options  Tag options (e.g. 'component="support"')
  * @return  string
  */
 private function _include($options)
 {
     $regex = "/type\\s*=\\s*(\"|&quot;)(script|stylesheet)(\"|&quot;)/i";
     if (!preg_match($regex, $options, $type)) {
         return '';
     }
     $regex = "/filename\\s*=\\s*(\"|&quot;)([^\"&]+)(\"|&quot;)/i";
     if (!preg_match($regex, $options, $file)) {
         return '';
     }
     $regex = "/component\\s*=\\s*(\"|&quot;)([^\"&]+)(\"|&quot;)/i";
     $template = App::get('template')->template;
     if ($file[2][0] == '/') {
         $filename = $file[2];
     } else {
         if (preg_match($regex, $options, $component)) {
             $filename = $this->_templateDir() . '/html/' . $component[2] . '/' . $file[2];
             //'templates/' . $template
             if (!file_exists(PATH_ROOT . $filename)) {
                 $filename = substr(Component::path($component[2]), strlen(PATH_ROOT)) . '/' . $file[2];
             }
         } else {
             $filename = $this->_templateDir() . '/';
             //"/templates/$template/";
             if ($type[2] == 'script') {
                 $filename .= 'js/';
             } else {
                 $filename .= 'css/';
             }
             $filename .= $file[2];
         }
     }
     if (!file_exists(PATH_ROOT . $filename)) {
         return '';
     }
     if ($type[2] == 'script') {
         Document::addScript(Request::base(true) . '/' . ltrim($filename, '/') . '?v=' . filemtime(PATH_ROOT . $filename));
     } else {
         if ($type[2] == 'stylesheet') {
             Document::addStyleSheet(Request::base(true) . '/' . ltrim($filename, '/') . '?v=' . filemtime(PATH_ROOT . $filename), 'text/css', 'screen');
         }
     }
     return '';
 }
示例#13
0
 /**
  * Return data on a group view (this will be some form of HTML)
  *
  * @param   object   $group       Current group
  * @param   string   $option      Name of the component
  * @param   string   $authorized  User's authorization level
  * @param   integer  $limit       Number of records to pull
  * @param   integer  $limitstart  Start of records to pull
  * @param   string   $action      Action to perform
  * @param   array    $access      What can be accessed
  * @param   array    $areas       Active area(s)
  * @return  array
  */
 public function onGroup($group, $option, $authorized, $limit = 0, $limitstart = 0, $action = '', $access, $areas = null)
 {
     $return = 'html';
     $active = 'usage';
     // The output array we're returning
     $arr = array('html' => '');
     //get this area details
     $this_area = $this->onGroupAreas();
     // Check if our area is in the array of areas we want to return results for
     if (is_array($areas) && $limit) {
         if (!in_array($this_area['name'], $areas)) {
             $return = '';
         }
     }
     if ($return == 'html') {
         //set group members plugin access level
         $group_plugin_acl = $access[$active];
         //get the group members
         $members = $group->get('members');
         //if set to nobody make sure cant access
         if ($group_plugin_acl == 'nobody') {
             $arr['html'] = '<p class="info">' . Lang::txt('GROUPS_PLUGIN_OFF', ucfirst($active)) . '</p>';
             return $arr;
         }
         //check if guest and force login if plugin access is registered or members
         if (User::isGuest() && ($group_plugin_acl == 'registered' || $group_plugin_acl == 'members')) {
             $url = Route::url('index.php?option=com_groups&cn=' . $group->get('cn') . '&active=' . $active, false, true);
             App::redirect(Route::url('index.php?option=com_users&view=login&return=' . base64_encode($url)), Lang::txt('GROUPS_PLUGIN_REGISTERED', ucfirst($active)), 'warning');
             return;
         }
         //check to see if user is member and plugin access requires members
         if (!in_array(User::get('id'), $members) && $group_plugin_acl == 'members' && $authorized != 'admin') {
             $arr['html'] = '<p class="info">' . Lang::txt('GROUPS_PLUGIN_REQUIRES_MEMBER', ucfirst($active)) . '</p>';
             return $arr;
         }
         //instantiate the db
         $database = App::get('db');
         //reference group for other functions
         $this->group = $group;
         //add usage stylesheet to view
         $this->css();
         //add datepicker stylesheet to view
         $this->css('jquery.datepicker.css', 'system')->css('jquery.timepicker.css', 'system');
         //add google js-api
         Document::addScript('https://www.google.com/jsapi');
         //add jquery from google cdn
         //Document::addScript('https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js');
         //add usage custom script
         $this->js('usage.js');
         //add datepicker script
         //$this->js('datepicker.js');
         //get the page id if we want to view stats on a specific page
         $pid = Request::getVar('pid', '');
         //get start and end dates
         $start = Request::getVar('start', gmdate("Y-m-d 00:00:00", strtotime('-30 DAYS')));
         $end = Request::getVar('end', gmdate("Y-m-d 23:59:59"));
         if (preg_match('/\\d{2}\\/\\d{2}\\/\\d{4}/', $start)) {
             $start = Date::of($start)->format('Y-m-d') . ' 00:00:00';
         }
         if (preg_match('/\\d{2}\\/\\d{2}\\/\\d{4}/', $end)) {
             $end = Date::of($end)->format('Y-m-d') . ' 00:00:00';
         }
         //make sure start date is a full php datetime
         if (strlen($start) != 19) {
             $start .= " 00:00:00";
         }
         //make sure end date is a full php datetime
         if (strlen($end) != 19) {
             $end .= " 23:59:59";
         }
         //generate script to draw chart and push to the page
         $script = $this->drawChart($pid, $start, $end);
         Document::addScriptDeclaration($script);
         //import and create view
         $view = $this->view('default', 'index');
         //get the group pages
         $query = "SELECT id, title FROM `#__xgroups_pages` WHERE state=1 AND gidNumber=" . $database->quote($group->get('gidNumber'));
         $database->setQuery($query);
         $view->pages = $database->loadAssocList();
         $view->option = $option;
         $view->group = $group;
         $view->authorized = $authorized;
         $view->database = $database;
         $view->pid = $pid;
         $view->start = $start;
         $view->end = $end;
         foreach ($this->getErrors() as $error) {
             $view->setError($error);
         }
         $arr['html'] = $view->loadTemplate();
     }
     return $arr;
 }
示例#14
0
    /**
     * Generate macro output
     *
     * @return     string
     */
    public function render()
    {
        //get the args passed in
        $content = $this->args;
        // args will be null if the macro is called without parenthesis.
        if (!$content) {
            return;
        }
        //generate a unique id for the slider
        $id = uniqid();
        //get the group
        $gid = Request::getVar('cn');
        //get the group object based on gid
        $group = \Hubzero\User\Group::getInstance($gid);
        //check to make sure we have a valid group
        if (!is_object($group)) {
            return;
        }
        //define a base url
        $base_url = DS . 'site' . DS . 'groups' . DS . $group->get('gidNumber');
        //seperate image list into array of images
        $slides = explode(',', $content);
        //array for checked slides
        $final_slides = array();
        //check each passed in slide
        foreach ($slides as $slide) {
            //check to see if image is external
            if (strpos($slide, 'http') === false) {
                $slide = trim($slide);
                //check if internal file actually exists
                if (is_file(PATH_APP . $base_url . DS . $slide)) {
                    $final_slides[] = $base_url . DS . $slide;
                }
            } else {
                $headers = get_headers($slide);
                if (strpos($headers[0], "OK") !== false) {
                    $final_slides[] = $slide;
                }
            }
        }
        $html = '';
        $html .= '<div class="wiki_slider">';
        $html .= '<div id="slider_' . $id . '">';
        foreach ($final_slides as $fs) {
            $html .= '<img src="' . $fs . '" alt="" />';
        }
        $html .= '</div>';
        $html .= '<div class="wiki_slider_pager" id="slider_' . $id . '_pager"></div>';
        $html .= '</div>';
        Document::addStyleSheet('plugins/wiki/parserdefault/macros/macro-assets/slider/slider.css');
        Document::addScript('plugins/wiki/parserdefault/macros/macro-assets/slider/slider.js');
        Document::addScriptDeclaration('
			jQuery(document).ready(function($) {
				$("#slider_' . $id . '").cycle({
					fx: \'scrollHorz\',
					speed: 450,
					pager: \'#slider_' . $id . '_pager\'
				});
			});
		');
        return $html;
    }
示例#15
0
/**
 * Error Template
 *
 * Template used for Special Groups. Will now be auto-created
 * when admin switches group from type HUB to type Special.
 *
 * @author 		Christopher Smoak
 * @copyright	December 2013
 */
// define base path
$base = str_replace(PATH_ROOT, '', __DIR__);
// add stylesheets and scripts
Document::addStyleSheet($base . DS . 'assets/css/main.css');
Document::addStyleSheet($base . DS . 'assets/css/error.css');
Document::addScript($base . DS . 'assets/js/main.js');
?>
<script>
	jQuery(document).ready(function(jq) {
		HUB.Modules.ReportProblems.initialize('.report');
	});
</script>
<div class="super-group-body-wrap group-<?php 
echo $this->group->get('cn');
?>
">
	<div class="super-group-body error-page">
		<div class="error-message"><?php 
echo $this->error->getMessage();
?>
</div>
示例#16
0
 /**
  * Return any options this element may have
  *
  * @param   string  $name          Name of the field
  * @param   string  $value         Value to check against
  * @param   object  $element       Data Source Object.
  * @param   string  $control_name  Control name (eg, control[fieldname])
  * @return  string  HTML
  */
 public function fetchElement($name, $value, &$element, $control_name)
 {
     if (!$this->_script) {
         Document::addScript('//maps.google.com/maps/api/js?sensor=false');
         Document::addScript(\Request::base(true) . '/core/components/com_publications/models/element/geo.js');
         $this->_script = true;
     }
     $size = isset($element->size) ? 'size="' . $element->size . '"' : '';
     $class = isset($element->class) ? 'class="geolocation ' . $element->class . '"' : 'class="geolocation"';
     $address = $this->_getValue('value', $value);
     $lat = $this->_getValue('lat', $value);
     $lat = trim($lat) ? $lat : '0.0';
     $lng = $this->_getValue('lng', $value);
     $lng = trim($lng) ? $lng : '0.0';
     $value = preg_replace('/<lat>(.*?)<\\/lat>/i', '', $value);
     $value = preg_replace('/<lng>(.*?)<\\/lng>/i', '', $value);
     /*
      * Required to avoid a cycle of encoding &
      * html_entity_decode was used in place of htmlspecialchars_decode because
      * htmlspecialchars_decode is not compatible with PHP 4
      */
     $value = htmlspecialchars(html_entity_decode($value, ENT_QUOTES), ENT_QUOTES);
     $html = '<input type="text" name="' . $control_name . '[' . $name . '][value]" id="' . $control_name . '-' . $name . '" value="' . $address . '" ' . $class . ' ' . $size . ' />';
     $html .= '<input type="hidden" name="' . $control_name . '[' . $name . '][lat]" id="' . $control_name . '-' . $name . '-lat" value="' . $lat . '" />';
     $html .= '<input type="hidden" name="' . $control_name . '[' . $name . '][lng]" id="' . $control_name . '-' . $name . '-lng" value="' . $lng . '" />';
     return $html;
 }
示例#17
0
    /**
     * Generate macro output
     *
     * @return     string
     */
    public function render()
    {
        //get the args passed in
        $content = $this->args;
        // args will be null if the macro is called without parenthesis.
        if (!$content) {
            return;
        }
        //generate a unique id for the slider
        $id = uniqid();
        // null base url for now
        $base_url = '';
        // needed objects
        $db = \App::get('db');
        $option = \Request::getCmd('option');
        $config = \Component::params($option);
        // define a base url
        switch ($option) {
            case 'com_groups':
                $cn = \Request::getVar('cn');
                $group = Group::getInstance($cn);
                $base_url = DS . trim($config->get('uploadpath', 'site/groups'), DS) . DS;
                $base_url .= $group->get('gidNumber') . DS . 'uploads';
                break;
            case 'com_resources':
                $row = new \Components\Resources\Tables\Resource($db);
                $row->load($this->pageid);
                $base_url = DS . trim($config->get('uploadpath', 'site/resources'), DS) . DS;
                $base_url .= \Components\Resources\Helpers\Html::build_path($row->created, $this->pageid, '') . DS . 'media';
                break;
        }
        //seperate image list into array of images
        $slides = array_map('trim', explode(',', $content));
        //array for checked slides
        $final_slides = array();
        //check each passed in slide
        foreach ($slides as $slide) {
            //check to see if image is external
            if (strpos($slide, 'http') === false) {
                $slide = trim($slide);
                //check if internal file actually exists
                if (is_file(PATH_APP . $base_url . DS . $slide)) {
                    $final_slides[] = $base_url . DS . $slide;
                }
            } else {
                $headers = get_headers($slide);
                if (strpos($headers[0], "OK") !== false) {
                    $final_slides[] = $slide;
                }
            }
        }
        $html = '';
        $html .= '<div class="wiki_slider">';
        $html .= '<div id="slider_' . $id . '">';
        foreach ($final_slides as $fs) {
            $html .= '<img src="' . $fs . '" alt="" />';
        }
        $html .= '</div>';
        $html .= '<div class="wiki_slider_pager" id="slider_' . $id . '_pager"></div>';
        $html .= '</div>';
        \Document::addStyleSheet('plugins/content/formathtml/macros/macro-assets/slider/slider.css');
        \Document::addScript('plugins/content/formathtml/macros/macro-assets/slider/slider.js');
        \Document::addScriptDeclaration('
			var $jQ = jQuery.noConflict();

			$jQ(function() {
				$jQ("#slider_' . $id . '").cycle({
					fx: \'scrollHorz\',
					speed: 450,
					pager: \'#slider_' . $id . '_pager\'
				});
			});
		');
        return $html;
    }