示例#1
0
 /**
  * enqueueDB
  * 
  * @param string $type 
  * @param int $id 
  * @static
  * @access public
  * @return void
  */
 public static function enqueueDB($type = '', $ids = array(), $action = 'index')
 {
     if ($type != '' && !empty($ids)) {
         $db = App::get('db');
         $userID = User::getInstance()->get('uidNumber');
         $timestamp = Date::of()->toSql();
         if ($db->tableExists('#__search_queue') && count($ids) > 0) {
             $sql = "INSERT INTO #__search_queue (type, type_id, status, action, created_by, created) VALUES ";
             foreach ($ids as $key => $id) {
                 if (!is_array($id)) {
                     $sql .= "('" . $type . "'," . $id . ", 0, '" . $action . "', " . $userID . ", '{$timestamp}}'),";
                 }
             }
             $sql = rtrim($sql, ',');
             $sql .= ';';
             try {
                 $db->setQuery($sql);
                 $db->query();
                 return true;
             } catch (\Exception $e) {
                 //@FIXME: properly handle this error
                 ddie($e->getMessage());
             }
         } else {
             throw new \Hubzero\Exception\Exception('Queue table does not exist.');
         }
     }
 }
示例#2
0
 /**
  * Pull records and build the XML
  *
  * @return  void
  */
 public function displayTask()
 {
     // Incoming
     $metadata = Request::getVar('metadataPrefix', 'oai_dc');
     $from = Request::getVar('from');
     if ($from) {
         $from = Date::of($from)->toSql();
     }
     $until = Request::getVar('until');
     if ($until) {
         $until = Date::of($until)->toSql();
     }
     $set = Request::getVar('set');
     $resumption = Request::getVar('resumptionToken');
     $igran = "YYYY-MM-DD";
     $igran .= $this->config->get('gran', 'c') == 'c' ? "Thh:mm:ssZ" : '';
     $hubname = rtrim($this->config->get('base_url', str_replace('https', 'http', \Request::base())), '/');
     $edate = $this->config->get('edate');
     $edate = $edate ? strtotime($edate) : time();
     $service = new Service($metadata, rtrim(Request::getSchemeAndHttpHost(), '/') . Route::url('index.php?option=' . $this->_option . '&task=stylesheet&metadataPrefix=' . $metadata));
     $service->set('metadataPrefix', $metadata)->set('repositoryName', $this->config->get('repository_name', \Config::get('sitename')))->set('baseURL', $hubname)->set('protocolVersion', '2.0')->set('adminEmail', $this->config->get('email', \Config::get('mailfrom')))->set('earliestDatestamp', gmdate('Y-m-d\\Th:i:s\\Z', $edate))->set('deletedRecord', $this->config->get('del'))->set('granularity', $igran)->set('max', $this->config->get('max', 500))->set('limit', $this->config->get('limig', 50))->set('allow_ore', $this->config->get('allow_ore', 0))->set('gran', $this->config->get('gran', 'c'))->set('resumption', $resumption);
     $verb = Request::getVar('verb');
     switch ($verb) {
         case 'GetRecord':
             $service->record(Request::getVar('identifier'));
             break;
         case 'Identify':
             $service->identify();
             break;
         case 'ListMetadataFormats':
             $service->formats();
             break;
         case 'ListIdentifiers':
             $service->identifiers($from, $until, $set);
             break;
         case 'ListRecords':
             $sessionTokenResumptionTemp = Session::get($resumption);
             if (!empty($resumption) && empty($sessionTokenResumptionTemp)) {
                 $service->error($service::ERROR_BAD_RESUMPTION_TOKEN);
             }
             $service->records($from, $until, $set);
             break;
         case 'ListSets':
             $sessionTokenResumptionTemp = Session::get($resumption);
             if (!empty($resumption) && empty($sessionTokenResumptionTemp)) {
                 $service->error($service::ERROR_BAD_RESUMPTION_TOKEN);
             }
             $service->sets();
             break;
         default:
             $service->error($service::ERROR_BAD_VERB, Lang::txt('COM_OAIPMH_ILLEGAL_VERB'));
             break;
     }
     Document::setType('xml');
     echo $service;
 }
示例#3
0
 /**
  * Event call to get the latest records
  *
  * @param   integer  $num
  * @param   string   $dateField
  * @param   string   $sort
  * @return  array
  */
 public function onGetLatest($num = 5, $dateField = 'created', $sort = 'DESC')
 {
     $model = Post::getLatest($num, $dateField, $sort)->rows()->toObject();
     $objects = array();
     foreach ($model as $m) {
         $object = new stdClass();
         $object->title = $m->title;
         $object->body = preg_replace('/[^ .,;a-zA-Z0-9_-]|[,;]/', '', $m->description);
         $object->date = Date::of($m->created)->toLocal("F j, Y");
         $object->path = $m->url;
         $object->id = $m->id;
         array_push($objects, $object);
     }
     return $objects;
 }
示例#4
0
 /**
  * Event call to get the latest records
  *
  * @param   integer  $num
  * @param   string   $dateField
  * @param   string   $sort
  * @return  array
  */
 public function onGetLatest($num = 5, $dateField = 'created', $sort = 'DESC')
 {
     $model = Resource::getLatest($num, $dateField, $sort)->rows()->toObject();
     $objects = array();
     foreach ($model as $m) {
         $object = new stdClass();
         $object->title = $m->title;
         $object->body = htmlspecialchars_decode($m->introtext);
         $object->date = Date::of($m->publish_up)->toLocal("F j, Y");
         $object->path = 'resources/' . $m->id;
         $object->id = $m->id;
         array_push($objects, $object);
     }
     return $objects;
 }
 /**
  * Down
  **/
 public function down()
 {
     if ($this->db->tableExists('#__feedaggregator_posts')) {
         require_once PATH_CORE . DS . 'components' . DS . 'com_feedaggregator' . DS . 'models' . DS . 'post.php';
         // Grab rows first
         $rows = Post::all()->rows();
         // Convert the field
         $query = "ALTER TABLE `#__feedaggregator_posts` MODIFY created INT(11);";
         $this->db->setQuery($query);
         $this->db->query();
         // Convert each timestamp into SQL date format
         foreach ($rows as $row) {
             $row->set('created', Date::of($row->created)->toUnix());
             $row->save();
         }
     }
 }
示例#6
0
 /**
  * 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)
 {
     $view = $this->view();
     $publication->authors();
     $publication->license();
     // Add metadata
     Document::setMetaData('citation_title', $view->escape($publication->title));
     $nullDate = '0000-00-00 00:00:00';
     $thedate = $publication->publish_up;
     if (!$thedate || $thedate == $nullDate) {
         $thedate = $publication->accepted;
     }
     if (!$thedate || $thedate == $nullDate) {
         $thedate = $publication->submitted;
     }
     if (!$thedate || $thedate == $nullDate) {
         $thedate = $publication->created;
     }
     if ($thedate && $thedate != $nullDate) {
         Document::setMetaData('citation_date', Date::of($thedate)->toLocal('Y-m-d'));
     }
     if ($doi = $publication->version->get('doi')) {
         Document::setMetaData('citation_doi', $view->escape($doi));
     }
     foreach ($publication->_authors as $contributor) {
         if (strtolower($contributor->role) == 'submitter') {
             continue;
         }
         if ($contributor->name) {
             $name = stripslashes($contributor->name);
         } else {
             $name = stripslashes($contributor->p_name);
         }
         if (!$contributor->organization) {
             $contributor->organization = $contributor->p_organization;
         }
         $contributor->organization = stripslashes(trim($contributor->organization));
         Document::setMetaData('citation_author', $view->escape($name));
         if ($contributor->organization) {
             Document::setMetaData('citation_author_institution', $view->escape($contributor->organization));
         }
     }
 }
示例#7
0
 /**
  * Display the overview
  */
 public function displayTask()
 {
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     $hubSearch = new SearchEngine();
     $hubSearch->getLog();
     $this->view->logs = array_slice($hubSearch->logs, -10, 10, true);
     // Need to fix permissions, www-data must be able to invoke start
     //$hubSearch->start();
     $helper = new Helper();
     $dataTypes = $helper->fetchDataTypes($hubSearch->getConfig());
     $insertTime = Date::of($hubSearch->lastInsert())->format('relative');
     $this->view->status = $hubSearch->ping();
     $this->view->lastInsert = $insertTime;
     $this->view->setLayout('overview');
     // Display the view
     $this->view->display();
 }
示例#8
0
 /**
  * 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)
 {
     $view = $this->view();
     $publication->authors();
     $publication->license();
     // Add metadata
     Document::setMetaData('dc.title', $view->escape($publication->title));
     $nullDate = '0000-00-00 00:00:00';
     if ($publication->publish_up && $publication->publish_up != $nullDate) {
         Document::setMetaData('dc.date', Date::of($publication->publish_up)->toLocal('Y-m-d'));
     }
     if ($publication->submitted && $publication->submitted != $nullDate) {
         Document::setMetaData('dc.date.submitted', Date::of($publication->submitted)->toLocal('Y-m-d'));
     }
     if ($publication->accepted && $publication->accepted != $nullDate) {
         Document::setMetaData('dc.date.approved', Date::of($publication->accepted)->toLocal('Y-m-d'));
     }
     if ($doi = $publication->version->get('doi')) {
         Document::setMetaData('dc.identifier', $view->escape($doi));
     }
     Document::setMetaData('dcterms.description', $view->escape($publication->abstract));
     $license = $publication->license();
     if (is_object($license)) {
         Document::setMetaData('dcterms.license', $view->escape($license->title));
     }
     foreach ($publication->_authors as $contributor) {
         if (strtolower($contributor->role) == 'submitter') {
             continue;
         }
         if ($contributor->name) {
             $name = stripslashes($contributor->name);
         } else {
             $name = stripslashes($contributor->p_name);
         }
         if (!$contributor->organization) {
             $contributor->organization = $contributor->p_organization;
         }
         $contributor->organization = stripslashes(trim($contributor->organization));
         Document::setMetaData('dcterms.creator', $view->escape($name . ($contributor->organization ? ', ' . $contributor->organization : '')));
     }
 }
示例#9
0
 /**
  * Get summary of time for each person on each day of the week
  *
  * @return  void
  */
 public static function getTimeForWeeklyBar()
 {
     $records = Record::all();
     $records->select('user_id')->select('SUM(time)', 'time')->select('DATE_FORMAT(CONVERT_TZ(date, "+00:00", "' . Config::get('offset', '+00:00') . '"), "%Y-%m-%d")', 'day')->group('user_id')->group('day');
     $users = [User::get('id')];
     // Add extra users for proxies
     foreach (Proxy::whereEquals('proxy_id', User::get('id')) as $proxy) {
         $users[] = $proxy->user_id;
     }
     $records->whereIn('user_id', $users);
     // Get the day of the week
     $today = Date::of(Request::getVar('week', time()));
     $dateofToday = $today->format('Y-m-d');
     $dayOfWeek = $today->format('N') - 1;
     $records->having('day', '>=', Date::of(strtotime("{$dateofToday} - {$dayOfWeek}days"))->toLocal('Y-m-d'))->having('day', '<', Date::of(strtotime("{$dateofToday} + " . (7 - $dayOfWeek) . 'days'))->toLocal('Y-m-d'));
     $rows = $records->including('user')->rows();
     foreach ($rows as $row) {
         $row->set('user_name', $row->user->name);
     }
     echo json_encode($rows->toArray());
     exit;
 }
示例#10
0
 /**
  * Process data
  *
  * @return     void
  */
 protected function _process()
 {
     // New project?
     $new = $this->model->exists() ? false : true;
     // Are we in setup?
     $setup = $new || $this->model->inSetup() ? true : false;
     // Incoming
     $private = Request::getInt('private', 1);
     // Save section
     switch ($this->section) {
         case 'describe':
         case 'info':
             // Incoming
             $name = trim(Request::getVar('name', '', 'post'));
             $title = trim(Request::getVar('title', '', 'post'));
             $name = preg_replace('/ /', '', $name);
             $name = strtolower($name);
             // Clean up title from any scripting
             $title = preg_replace('/\\s+/', ' ', $title);
             $title = $this->_txtClean($title);
             // Check incoming data
             if ($setup && $new && !$this->model->check($name, $this->model->get('id'))) {
                 $this->setError(Lang::txt('COM_PROJECTS_ERROR_NAME_INVALID_OR_EMPTY'));
                 return false;
             } elseif (!$title) {
                 $this->setError(Lang::txt('COM_PROJECTS_ERROR_TITLE_SHORT_OR_EMPTY'));
                 return false;
             }
             if ($this->model->exists()) {
                 $this->model->set('modified', Date::toSql());
                 $this->model->set('modified_by', User::get('id'));
             } else {
                 $this->model->set('alias', $name);
                 $this->model->set('created', Date::toSql());
                 $this->model->set('created_by_user', User::get('id'));
                 $this->model->set('owned_by_group', $this->_gid);
                 $this->model->set('owned_by_user', User::get('id'));
                 $this->model->set('private', $this->config->get('privacy', 1));
             }
             $this->model->set('title', \Hubzero\Utility\String::truncate($title, 250));
             $this->model->set('about', trim(Request::getVar('about', '', 'post', 'none', 2)));
             $this->model->set('type', Request::getInt('type', 1, 'post'));
             // save advanced permissions
             if (isset($_POST['private'])) {
                 $this->model->set('private', $private);
             }
             if ($setup && !$this->model->exists()) {
                 // Copy params from default project type
                 $objT = $this->model->table('Type');
                 $this->model->set('params', $objT->getParams($this->model->get('type')));
             }
             // Save changes
             if (!$this->model->store()) {
                 $this->setError($this->model->getError());
                 return false;
             }
             // Save owners for new projects
             if ($new) {
                 $this->_identifier = $this->model->get('alias');
                 // Group owners
                 $objO = $this->model->table('Owner');
                 if ($this->_gid) {
                     if (!$objO->saveOwners($this->model->get('id'), User::get('id'), 0, $this->_gid, 0, 1, 1, '', $split_group_roles = 0)) {
                         $this->setError(Lang::txt('COM_PROJECTS_ERROR_SAVING_AUTHORS') . ': ' . $objO->getError());
                         return false;
                     }
                     // Make sure project creator is manager
                     $objO->reassignRole($this->model->get('id'), $users = array(User::get('id')), 0, 1);
                 } elseif (!$objO->saveOwners($this->model->get('id'), User::get('id'), User::get('id'), $this->_gid, 1, 1, 1)) {
                     $this->setError(Lang::txt('COM_PROJECTS_ERROR_SAVING_AUTHORS') . ': ' . $objO->getError());
                     return false;
                 }
             }
             break;
         case 'team':
             if ($new) {
                 return false;
             }
             // Save team
             $content = Event::trigger('projects.onProject', array($this->model, 'save', array('team')));
             if (isset($content[0]) && $this->next == $this->section) {
                 if (isset($content[0]['msg']) && !empty($content[0]['msg'])) {
                     $this->_setNotification($content[0]['msg']['message'], $content[0]['msg']['type']);
                 }
             }
             break;
         case 'settings':
             if ($new) {
                 return false;
             }
             // Save privacy
             if (isset($_POST['private'])) {
                 $this->model->set('private', $private);
                 // Save changes
                 if (!$this->model->store()) {
                     $this->setError($this->model->getError());
                     return false;
                 }
             }
             // Save params
             $incoming = Request::getVar('params', array());
             if (!empty($incoming)) {
                 foreach ($incoming as $key => $value) {
                     $this->model->saveParam($key, $value);
                     // If grant information changed
                     if ($key == 'grant_status') {
                         // Meta data for comment
                         $meta = '<meta>' . Date::of('now')->toLocal('M d, Y') . ' - ' . User::get('name') . '</meta>';
                         $cbase = $this->model->get('admin_notes');
                         $cbase .= '<nb:sponsored>' . Lang::txt('COM_PROJECTS_PROJECT_MANAGER_GRANT_INFO_UPDATE') . $meta . '</nb:sponsored>';
                         $this->model->set('admin_notes', $cbase);
                         // Save admin notes
                         if (!$this->model->store()) {
                             $this->setError($this->model->getError());
                             return false;
                         }
                         $admingroup = $this->config->get('ginfo_group', '');
                         if (\Hubzero\User\Group::getInstance($admingroup)) {
                             $admins = Helpers\Html::getGroupMembers($admingroup);
                             // Send out email to admins
                             if (!empty($admins)) {
                                 Helpers\Html::sendHUBMessage($this->_option, $this->model, $admins, Lang::txt('COM_PROJECTS_EMAIL_ADMIN_REVIEWER_NOTIFICATION'), 'projects_new_project_admin', 'admin', Lang::txt('COM_PROJECTS_PROJECT_MANAGER_GRANT_INFO_UPDATE'), 'sponsored');
                             }
                         }
                     }
                 }
             }
             break;
     }
 }
示例#11
0
 /**
  * Static method for formatting results
  *
  * @param      object $row Database row
  * @return     string HTML
  */
 public static function out($row)
 {
     $row->href = Route::url($row->href);
     $month = Date::of($row->publish_up)->toLocal('M');
     $day = Date::of($row->publish_up)->toLocal('d');
     $year = Date::of($row->publish_up)->toLocal('Y');
     // Start building the HTML
     $html = "\t" . '<li class="event">' . "\n";
     $html .= "\t\t" . '<p class="event-date"><span class="month">' . $month . '</span> <span class="day">' . $day . '</span> <span class="year">' . $year . '</span></p>' . "\n";
     $html .= "\t\t" . '<p class="title"><a href="' . $row->href . '">' . stripslashes($row->title) . '</a></p>' . "\n";
     if ($row->ftext) {
         $row->ftext = str_replace('[[BR]]', '', $row->ftext);
         // Remove tags to prevent tables from being displayed within a table.
         $row->ftext = strip_tags($row->ftext);
         $html .= "\t\t" . \Hubzero\Utility\String::truncate(\Hubzero\Utility\Sanitize::stripAll(stripslashes($row->ftext)), 200) . "\n";
     }
     $html .= "\t\t" . '<p class="href">' . Request::base() . trim($row->href, '/') . '</p>' . "\n";
     $html .= "\t" . '</li>' . "\n";
     // Return output
     return $html;
 }
示例#12
0
</span> <?php 
echo \Hubzero\Utility\String::truncate($this->pub->title, 65);
?>
 | <?php 
echo Lang::txt('COM_PUBLICATIONS_CURATION_VERSION') . ' ' . $this->pub->version_label;
?>
		</h3>
	</div>
	<p class="instruct">
		<span class="pubimage"><img src="<?php 
echo Route::url('index.php?option=com_publications&id=' . $this->pub->id . '&v=' . $this->pub->version_id) . '/Image:thumb';
?>
" alt="" /></span>
		<strong class="block"><?php 
echo $this->pub->reviewed ? Lang::txt('COM_PUBLICATIONS_CURATION_RESUBMITTED') : Lang::txt('COM_PUBLICATIONS_CURATION_SUBMITTED');
echo ' ' . Date::of($this->pub->submitted)->toLocal('M d, Y') . ' ' . Lang::txt('COM_PUBLICATIONS_CURATION_BY') . ' ' . $this->pub->modifier('name');
?>
</strong>
		<?php 
if ($this->pub->curator()) {
    ?>
		<span class="block"><?php 
    echo Lang::txt('COM_PUBLICATIONS_CURATION_ASSIGNED_CURATOR') . ' <strong>' . $this->pub->curator('name') . ' (' . $this->pub->curator('username') . ')</strong>';
    ?>
</span>
		<?php 
}
?>
	<?php 
echo Lang::txt('COM_PUBLICATIONS_CURATION_REVIEW_AND_ACT');
?>
示例#13
0
			<?php 
}
?>

			<div class="container blog-entries-years">
				<h4><?php 
echo Lang::txt('COM_BLOG_ENTRIES_BY_YEAR');
?>
</h4>
				<ol>
				<?php 
if ($first->get('id')) {
    $entry_year = substr($this->row->get('publish_up'), 0, 4);
    $entry_month = substr($this->row->get('publish_up'), 5, 2);
    $start = intval(substr($first->get('publish_up'), 0, 4));
    $now = Date::of('now')->format("Y");
    //$mon = date("m");
    for ($i = $now, $n = $start; $i >= $n; $i--) {
        ?>
						<li>
							<a href="<?php 
        echo Route::url('index.php?option=' . $this->option . '&year=' . $i);
        ?>
">
								<?php 
        echo $i;
        ?>
							</a>
							<?php 
        if ($i == $entry_year) {
            ?>
示例#14
0
?>
</h4>
	<?php 
if (count($this->rows2) <= 0) {
    ?>
		<p><?php 
    echo Lang::txt('MOD_MYWISHES_NO_WISHES');
    ?>
</p>
	<?php 
} else {
    ?>
		<ul class="expandedlist">
			<?php 
    foreach ($this->rows2 as $row) {
        $when = Date::of($row->proposed)->relative();
        $title = strip_tags($row->about) ? $this->escape(stripslashes($row->subject)) . ' :: ' . \Hubzero\Utility\String::truncate($this->escape(strip_tags($row->about)), 160) : NULL;
        ?>
			<li class="wishlist">
				<a href="<?php 
        echo Route::url('index.php?option=com_wishlist&task=wish&id=' . $row->wishlist . '&wishid=' . $row->id);
        ?>
" class="tooltips" title="<?php 
        echo $title;
        ?>
">
					#<?php 
        echo $row->id;
        ?>
: <?php 
        echo \Hubzero\Utility\String::truncate(stripslashes($row->subject), 35);
示例#15
0
 /**
  * Initiate sync
  *
  * @return  void
  */
 protected function _iniSync()
 {
     // Incoming
     $ajax = Request::getInt('ajax', 0);
     $auto = Request::getInt('auto', 0);
     $queue = Request::getInt('queue', 0);
     // Timed sync?
     $autoSync = $this->params->get('auto_sync', 0);
     $this->_rSync = new Sync($this->_connect);
     // Remote service(s) active?
     if (!empty($this->_connect->_active) && $this->repo->isLocal()) {
         // Get remote files for each active service
         foreach ($this->_connect->_active as $servicename) {
             // Set syncing service
             $this->_rSync->set('service', $servicename);
             // Get time of last sync
             $synced = $this->model->params->get($servicename . '_sync');
             // Stop if auto sync request and not enough time passed
             if ($auto && $autoSync && !$queue) {
                 if ($autoSync < 1) {
                     $hr = 60 * $autoSync;
                     $timecheck = Date::of(time() - 1 * $hr * 60);
                 } else {
                     $timecheck = Date::of(time() - $autoSync * 60 * 60);
                 }
                 if ($synced > $timecheck) {
                     return json_encode(array('status' => 'waiting'));
                 }
             }
             // Send sync request
             $success = $this->_rSync->sync($servicename, $queue, $auto);
             // Unlock sync
             if ($success) {
                 $this->_rSync->lockSync($servicename, true);
             }
             // Success message
             $this->_rSync->set('message', Lang::txt('PLG_PROJECTS_FILES_SYNC_SUCCESS'));
         }
     }
     $this->_rSync->set('auto', $auto);
     if (!$ajax) {
         return $this->_browse();
     } else {
         $this->_rSync->set('output', $this->_browse());
         return json_encode($this->_rSync->getStatus());
     }
 }
示例#16
0
 /**
  * Generate macro output
  *
  * @return     string
  */
 public function render()
 {
     $et = $this->args;
     $live_site = rtrim(Request::base(), '/');
     // What pages are we getting?
     if ($et) {
         $et = strip_tags($et);
         // Get pages with a prefix
         $sql = "SELECT * FROM `#__wiki_attachments` WHERE LOWER(filename) LIKE '" . strtolower($et) . "%' AND pageid='" . $this->pageid . "' ORDER BY created ASC";
     } else {
         // Get all pages
         $sql = "SELECT * FROM `#__wiki_attachments` WHERE pageid='" . $this->pageid . "' ORDER BY created ASC";
     }
     // Perform query
     $this->_db->setQuery($sql);
     $rows = $this->_db->loadObjectList();
     // Did we get a result from the database?
     if ($rows) {
         $config = Component::params('com_wiki');
         if ($this->filepath != '') {
             $config->set('filepath', $this->filepath);
         }
         $page = new \Components\Wiki\Models\Page($this->pageid);
         if ($page->get('namespace') == 'help') {
             $page->set('scope', $page->get('scope') ? rtrim($this->scope, '/') . '/' . ltrim($page->get('scope'), '/') : $this->scope);
             $page->set('group_cn', $this->domain);
         }
         // Build and return the link
         $html = '<ul>';
         foreach ($rows as $row) {
             $page->set('pagename', $page->get('pagename') . '/' . 'File:' . $row->filename);
             $link = $page->link();
             //$live_site . substr(PATH_APP, strlen(PATH_ROOT)) . DS . trim($config->get('filepath', '/site/wiki'), DS) . DS . $this->pageid . DS . $row->filename;
             $fpath = PATH_APP . DS . trim($config->get('filepath', '/site/wiki'), DS) . DS . $this->pageid . DS . $row->filename;
             $html .= '<li><a href="' . Route::url($link) . '">' . $row->filename . '</a> (' . (file_exists($fpath) ? \Hubzero\Utility\Number::formatBytes(filesize($fpath)) : '-- file not found --') . ') ';
             $huser = User::getInstance($row->created_by);
             if ($huser->get('id')) {
                 $html .= '- added by <a href="' . Route::url('index.php?option=com_members&id=' . $huser->get('id')) . '">' . stripslashes($huser->get('name')) . '</a> ';
             }
             if ($row->created && $row->created != '0000-00-00 00:00:00') {
                 $html .= Date::of($row->created)->relative() . '. ';
             }
             $html .= $row->description ? '<span>"' . stripslashes($row->description) . '"</span>' : '';
             $html .= '</li>' . "\n";
         }
         $html .= '</ul>';
         return $html;
     } else {
         // Return error message
         //return '(TitleIndex('.$et.') failed)';
         return '(No ' . $et . ' files to display)';
     }
 }
示例#17
0
						<a href="<?php 
            echo Route::url($base . ($this->collection->get('is_default') ? '' : '/' . $this->collection->get('alias')));
            ?>
">
							<?php 
            echo $this->escape(stripslashes($this->collection->get('title')));
            ?>
						</a>
						<br />
						<span class="entry-date">
							<span class="entry-date-at">@</span> <span class="date"><?php 
            echo Date::of($row->get('created'))->toLocal(Lang::txt('TIME_FORMAT_HZ1'));
            ?>
</span>
							<span class="entry-date-on">on</span> <span class="time"><?php 
            echo Date::of($row->get('created'))->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
            ?>
</span>
						</span>
					</p>
				</div><!-- / .attribution -->
			<?php 
        }
        ?>
			</div><!-- / .content -->
		</div><!-- / .post -->
<?php 
    }
} else {
    ?>
		<div id="collection-introduction">
示例#18
0
 * @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
 * @license   http://opensource.org/licenses/MIT MIT
 */
// No direct access.
defined('_HZEXEC_') or die;
$canDo = \Components\Store\Helpers\Permissions::getActions('component');
$text = !$this->store_enabled ? ' (store is disabled)' : '';
Toolbar::title(Lang::txt('COM_STORE_MANAGER') . $text, 'addedit.png');
if ($canDo->get('core.edit')) {
    Toolbar::save();
}
Toolbar::cancel();
Toolbar::spacer();
Toolbar::help('order');
$order_date = intval($this->row->ordered) != 0 ? Date::of($this->row->ordered)->toLocal(Lang::txt('COM_STORE_DATE_FORMAT_HZ1')) : NULL;
$status_changed = intval($this->row->status_changed) != 0 ? Date::of($this->row->status_changed)->toLocal(Lang::txt('COM_STORE_DATE_FORMAT_HZ1')) : NULL;
$class = 'completed-item';
switch ($this->row->status) {
    case '1':
        $status = strtolower(Lang::txt('COM_STORE_COMPLETED'));
        break;
    case '0':
    default:
        $status = strtolower(Lang::txt('COM_STORE_NEW'));
        $class = 'new-item';
        break;
    case '2':
        $status = strtolower(Lang::txt('COM_STORE_CANCELLED'));
        $class = 'cancelled-item';
        break;
}
示例#19
0
 /**
  * Display a feed of comments
  *
  * @return    void
  */
 protected function _feed()
 {
     if (!$this->params->get('comments_feeds')) {
         $this->action = 'view';
         $this->_view();
         return;
     }
     // Set the mime encoding for the document
     Document::setType('feed');
     // Load the comments
     $comment = new \Plugins\Hubzero\Comments\Models\Comment();
     $filters = array('parent' => 0, 'item_type' => $this->obj_type, 'item_id' => $this->obj_id);
     if ($this->obj instanceof \Hubzero\Base\Model) {
         $title = $this->obj->get('title');
     } else {
         $title = $this->obj->title;
     }
     // Start a new feed object
     $doc = Document::instance();
     $doc->link = Route::url($this->url);
     $doc->title = Config::get('sitename') . ' - ' . Lang::txt(strtoupper($this->_option));
     $doc->title .= $title ? ': ' . stripslashes($title) : '';
     $doc->title .= ': ' . Lang::txt('PLG_HUBZERO_COMMENTS');
     $doc->description = Lang::txt('PLG_HUBZERO_COMMENTS_RSS_DESCRIPTION', Config::get('sitename'), stripslashes($title));
     $doc->copyright = Lang::txt('PLG_HUBZERO_COMMENTS_RSS_COPYRIGHT', date("Y"), Config::get('sitename'));
     // Start outputing results if any found
     if ($comment->replies('list', $filters)->total() > 0) {
         foreach ($comment->replies() as $row) {
             // URL link to article
             $link = Route::url('index.php?option=' . $this->_option . '&section=' . $section->alias . '&category=' . $category->alias . '&alias=' . $entry->alias . '#c' . $row->id);
             $author = Lang::txt('PLG_HUBZERO_COMMENTS_ANONYMOUS');
             if (!$row->get('anonymous')) {
                 $author = $row->creator('name');
             }
             // Prepare the title
             $title = Lang::txt('PLG_HUBZERO_COMMENTS_COMMENT_BY', $author) . ' @ ' . $row->created('time') . ' on ' . $row->created('date');
             // Strip html from feed item description text
             if ($row->isReported()) {
                 $description = Lang::txt('PLG_HUBZERO_COMMENTS_REPORTED_AS_ABUSIVE');
             } else {
                 $description = $row->content('clean');
             }
             @($date = $row->created() ? date('r', strtotime($row->created())) : '');
             // Load individual item creator class
             $item = new \Hubzero\Document\Type\Feed\Item();
             $item->title = $title;
             $item->link = $link;
             $item->description = $description;
             $item->date = $date;
             $item->category = '';
             $item->author = $author;
             // Loads item info into rss array
             $doc->addItem($item);
             // Check for any replies
             if ($row->replies()->total()) {
                 foreach ($row->replies() as $reply) {
                     // URL link to article
                     $link = Route::url('index.php?option=' . $this->_option . '&section=' . $section->alias . '&category=' . $category->alias . '&alias=' . $entry->alias . '#c' . $reply->id);
                     $author = Lang::txt('PLG_HUBZERO_COMMENTS_ANONYMOUS');
                     if (!$reply->anonymous) {
                         $cuser = User::getInstance($reply->created_by);
                         $author = $cuser->get('name');
                     }
                     // Prepare the title
                     $title = Lang::txt('PLG_HUBZERO_COMMENTS_REPLY_TO_COMMENT', $row->id, $author) . ' @ ' . Date::of($reply->created)->toLocal(Lang::txt('TIME_FORMAT_HZ1')) . ' ' . Lang::txt('PLG_HUBZERO_COMMENTS_ON') . ' ' . Date::of($reply->created)->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
                     // Strip html from feed item description text
                     if ($reply->reports) {
                         $description = Lang::txt('PLG_HUBZERO_COMMENTS_REPORTED_AS_ABUSIVE');
                     } else {
                         $description = is_object($p) ? $p->parse(stripslashes($reply->content)) : nl2br(stripslashes($reply->content));
                     }
                     $description = html_entity_decode(\Hubzero\Utility\Sanitize::clean($description));
                     @($date = $reply->created ? gmdate('r', strtotime($reply->created)) : '');
                     // Load individual item creator class
                     $item = new \Hubzero\Document\Type\Feed\Item();
                     $item->title = $title;
                     $item->link = $link;
                     $item->description = $description;
                     $item->date = $date;
                     $item->category = '';
                     $item->author = $author;
                     // Loads item info into rss array
                     $doc->addItem($item);
                     if ($reply->replies) {
                         foreach ($reply->replies as $response) {
                             // URL link to article
                             $link = Route::url('index.php?option=' . $this->_option . '&section=' . $section->alias . '&category=' . $category->alias . '&alias=' . $entry->alias . '#c' . $response->id);
                             $author = Lang::txt('PLG_HUBZERO_COMMENTS_ANONYMOUS');
                             if (!$response->anonymous) {
                                 $cuser = User::getInstance($response->created_by);
                                 $author = $cuser->get('name');
                             }
                             // Prepare the title
                             $title = Lang::txt('PLG_HUBZERO_COMMENTS_REPLY_TO_COMMENT', $reply->id, $author) . ' @ ' . Date::of($response->created)->toLocal(Lang::txt('TIME_FORMAT_HZ1')) . ' ' . Lang::txt('PLG_HUBZERO_COMMENTS_ON') . ' ' . Date::of($response->created)->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
                             // Strip html from feed item description text
                             if ($response->reports) {
                                 $description = Lang::txt('PLG_HUBZERO_COMMENTS_REPORTED_AS_ABUSIVE');
                             } else {
                                 $description = is_object($p) ? $p->parse(stripslashes($response->content)) : nl2br(stripslashes($response->content));
                             }
                             $description = html_entity_decode(\Hubzero\Utility\Sanitize::clean($description));
                             @($date = $response->created ? gmdate('r', strtotime($response->created)) : '');
                             // Load individual item creator class
                             $item = new \Hubzero\Document\Type\Feed\Item();
                             $item->title = $title;
                             $item->link = $link;
                             $item->description = $description;
                             $item->date = $date;
                             $item->category = '';
                             $item->author = $author;
                             // Loads item info into rss array
                             $doc->addItem($item);
                         }
                     }
                 }
             }
         }
     }
     // Output the feed
     echo $doc->render();
 }
示例#20
0
 *
 * 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.
 *
 */
// No direct access
defined('_HZEXEC_') or die;
$database = \App::get('db');
// Get version authors
$pa = new \Components\Publications\Tables\Author($database);
?>

<ul class="mypubs">
<?php 
foreach ($this->results as $row) {
    // Get version authors
    $authors = $pa->getAuthors($row->version_id);
    $info = array();
    $info[] = Date::of($row->published_up)->toLocal('d M Y');
    $info[] = $row->cat_name;
    $info[] = Lang::txt('COM_PUBLICATIONS_CONTRIBUTORS') . ': ' . \Components\Publications\Helpers\Html::showContributors($authors, false, true);
    // Display List of items
    $this->view('_item')->set('option', 'com_publications')->set('row', $row)->set('info', $info)->display();
}
?>
</ul>
 */
// No direct access
defined('_HZEXEC_') or die;
$base = rtrim(Request::base(), '/');
$base = rtrim(str_replace('/administrator', '', $base), '/');
$sef = Route::url('index.php?option=' . $this->option . '&alias=' . $this->project->get('alias'));
$link = rtrim($base, DS) . DS . trim($sef, DS);
$message = Lang::txt('COM_PROJECTS_EMAIL_ADMIN_NEW_PUB_STATUS') . "\n";
$message .= '-------------------------------' . "\n";
$message .= Lang::txt('COM_PROJECTS_PROJECT') . ': ' . $this->project->get('title') . ' (' . $this->project->get('alias');
if ($this->project->isProvisioned()) {
    $message .= ' - ' . Lang::txt('COM_PROJECTS_PROVISIONED');
}
$message .= ')' . "\n";
if (!$this->project->isProvisioned()) {
    $message .= ucfirst(Lang::txt('COM_PROJECTS_CREATED')) . ' ' . Date::of($this->project->get('created'))->toLocal('M d, Y') . ' ' . Lang::txt('COM_PROJECTS_BY') . ' ';
    $message .= $this->project->groupOwner() ? $this->project->groupOwner('cn') . ' ' . Lang::txt('COM_PROJECTS_GROUP') : $this->project->owner('name');
}
$message .= "\n";
if ($this->project->isPublic()) {
    $message .= Lang::txt('COM_PROJECTS_EMAIL_URL') . ': ' . $link . "\n";
}
$message .= '-------------------------------' . "\n\n";
// Append a message
if ($this->message) {
    $message .= $this->message . "\n";
    $message .= '-------------------------------' . "\n\n";
}
$message = str_replace('<br />', '', $message);
$message = preg_replace('/\\n{3,}/', "\n\n", $message);
echo $message;
示例#22
0
            ?>
						<?php 
        }
        ?>
					</div><!-- / .wish-tags -->
				</div><!-- / .wish-content -->

				<?php 
        if ($this->wishlist->access('manage')) {
            $eligible = array_merge($this->wishlist->owners('individuals'), $this->wishlist->owners('advisory'));
            $eligible = array_unique($eligible);
            $voters = $this->wish->get('num_votes') <= count($eligible) ? count($eligible) : $this->wish->get('num_votes');
            //$html .= "\t\t\t".'<div class="wishpriority">'.Lang::txt('PRIORITY').': '.$this->wish->ranking.' <span>('.$this->wish->num_votes.' '.Lang::txt('NOTICE_OUT_OF').' '.$voters.' '.Lang::txt('VOTES').')</span>';
            $html = '';
            if ($this->wish->due() != '0000-00-00 00:00:00' && !$this->wish->isGranted()) {
                $html .= $this->wish->get('due') <= Date::of('now')->toSql() ? '<span class="overdue"><a href="' . Route::url($this->wish->link('editplan')) . '">' . Lang::txt('COM_WISHLIST_OVERDUE') : '<span class="due"><a href="' . Route::url($this->wish->link('editplan')) . '">' . Lang::txt('COM_WISHLIST_WISH_DUE_IN') . ' ' . WishlistHTML::nicetime($this->wish->get('due'));
                $html .= '</a></span>';
            }
            //$html .= '</div>'."\n";
            echo $html;
        }
        ?>
				<ul class="wish-options">
					<?php 
        if ($this->wishlist->access('admin') && $this->wishlist->get('admin') != 3) {
            ?>
						<?php 
            if (!$this->wish->isGranted()) {
                ?>
							<li>
								<a class="changestatus" href="<?php 
示例#23
0
 /**
  * Send a message to one or more users
  *
  * @param      string  $type        Message type (maps to #__xmessage_component table)
  * @param      string  $subject     Message subject
  * @param      string  $message     Message to send
  * @param      array   $from        Message 'from' data (e.g., name, address)
  * @param      array   $to          List of user IDs
  * @param      string  $component   Component name
  * @param      integer $element     ID of object that needs an action item
  * @param      string  $description Action item description
  * @param      integer $group_id    Parameter description (if any) ...
  * @return     mixed   True if no errors else error message
  */
 public function onSendMessage($type, $subject, $message, $from = array(), $to = array(), $component = '', $element = null, $description = '', $group_id = 0, $bypassGroupsCheck = false)
 {
     // Do we have a message?
     if (!$message) {
         return false;
     }
     $database = App::get('db');
     // Create the message object
     $xmessage = Hubzero\Message\Message::blank();
     if ($type == 'member_message') {
         $time_limit = intval($this->params->get('time_limit', 30));
         $daily_limit = intval($this->params->get('daily_limit', 100));
         // First, let's see if they've surpassed their daily limit for sending messages
         $filters = array('created_by' => User::get('id'), 'daily_limit' => $daily_limit);
         $number_sent = $xmessage->getSentMessagesCount($filters);
         if ($number_sent >= $daily_limit) {
             return false;
         }
         // Next, we see if they've passed the time limit for sending consecutive messages
         $filters['limit'] = 1;
         $filters['start'] = 0;
         $sent = $xmessage->getSentMessages($filters);
         if ($sent->count() > 0) {
             $last_sent = $sent->first();
             $last_time = 0;
             if ($last_sent->created) {
                 $last_time = Date::of($last_sent->created)->toUnix();
             }
             $time_difference = Date::toUnix() + $time_limit - $last_time;
             if ($time_difference < $time_limit) {
                 return false;
             }
         }
     }
     // Store the message in the database
     $xmessage->set('message', is_array($message) && isset($message['plaintext']) ? $message['plaintext'] : $message);
     // Do we have a subject line? If not, create it from the message
     if (!$subject && $xmessage->get('message')) {
         $subject = substr($xmessage->get('message'), 0, 70);
         if (strlen($subject) >= 70) {
             $subject .= '...';
         }
     }
     $xmessage->set('subject', $subject);
     $xmessage->set('created', Date::toSql());
     $xmessage->set('created_by', User::get('id'));
     $xmessage->set('component', $component);
     $xmessage->set('type', $type);
     $xmessage->set('group_id', $group_id);
     if (!$xmessage->save()) {
         return $xmessage->getError();
     }
     if (is_array($message)) {
         $xmessage->set('message', $message);
     }
     // Do we have any recipients?
     if (count($to) > 0) {
         $mconfig = Component::params('com_members');
         // Get all the sender's groups
         if ($mconfig->get('user_messaging', 1) == 1 && !$bypassGroupsCheck) {
             $xgroups = User::groups('all');
             $usersgroups = array();
             if (!empty($xgroups)) {
                 foreach ($xgroups as $group) {
                     if ($group->regconfirmed) {
                         $usersgroups[] = $group->cn;
                     }
                 }
             }
         }
         // Loop through each recipient
         foreach ($to as $uid) {
             // Create a recipient object that ties a user to a message
             $recipient = Hubzero\Message\Recipient::blank();
             $recipient->set('uid', $uid);
             $recipient->set('mid', $xmessage->get('id'));
             $recipient->set('created', Date::toSql());
             $recipient->set('expires', Date::of(time() + 168 * 24 * 60 * 60)->toSql());
             $recipient->set('actionid', 0);
             //(is_object($action)) ? $action->id : 0; [zooley] Phasing out action items
             // Get the user's methods for being notified
             $notify = Hubzero\Message\Notify::blank();
             $methods = $notify->getRecords($uid, $type);
             $user = User::getInstance($uid);
             if (!is_object($user) || !$user->get('username')) {
                 continue;
             }
             if ($mconfig->get('user_messaging', 1) == 1 && ($type == 'member_message' || $type == 'group_message')) {
                 $pgroups = \Hubzero\User\Helper::getGroups($user->get('id'), 'all', 1);
                 $profilesgroups = array();
                 if (!empty($pgroups)) {
                     foreach ($pgroups as $group) {
                         if ($group->regconfirmed) {
                             $profilesgroups[] = $group->cn;
                         }
                     }
                 }
                 // Find the common groups
                 if (!$bypassGroupsCheck) {
                     $common = array_intersect($usersgroups, $profilesgroups);
                     if (count($common) <= 0) {
                         continue;
                     }
                 }
             }
             // Do we have any methods?
             if ($methods->count()) {
                 // Loop through each method
                 foreach ($methods as $method) {
                     $action = strtolower($method->method);
                     if ($action == 'internal') {
                         if (!$recipient->save()) {
                             $this->setError($recipient->getError());
                         }
                     } else {
                         if (!Event::trigger('onMessage', array($from, $xmessage, $user, $action))) {
                             $this->setError(Lang::txt('PLG_XMESSAGE_HANDLER_ERROR_UNABLE_TO_MESSAGE', $uid, $action));
                         }
                     }
                 }
             } else {
                 // First check if they have ANY methods saved (meaning they've changed their default settings)
                 // If They do have some methods, then they simply turned off everything for this $type
                 $methods = $notify->getRecords($uid);
                 if (!$methods || $methods->count() <= 0) {
                     // Load the default method
                     $p = Plugin::byType('members', 'messages');
                     $pp = new \Hubzero\Config\Registry(is_object($p) ? $p->params : '');
                     $d = $pp->get('default_method', 'email');
                     if (!$recipient->save()) {
                         $this->setError($recipient->getError());
                     }
                     // Use the Default in the case the user has no methods
                     if (!Event::trigger('onMessage', array($from, $xmessage, $user, $d))) {
                         $this->setError(Lang::txt('PLG_XMESSAGE_HANDLER_ERROR_UNABLE_TO_MESSAGE', $uid, $d));
                     }
                 }
             }
         }
     }
     return true;
 }
示例#24
0
        $preview = $row->message ? "<h3>Message Preview:</h3>" . nl2br(stripslashes($row->message)) : "";
        //subject link
        $subject_cls = "message-link";
        $subject_cls .= $row->whenseen != '' && $row->whenseen != '0000-00-00 00:00:00' ? "" : " unread";
        $subject = "<a class=\"{$subject_cls}\" href=\"{$url}\">{$subject}";
        //$subject .= "<div class=\"preview\"><span>" . $preview . "</span></div>";
        $subject .= "</a>";
        //get who the message is from
        if (substr($row->type, -8) == '_message') {
            $u = User::getInstance($row->created_by);
            $from = '<a href="' . Route::url('index.php?option=' . $this->option . '&id=' . $u->get('id')) . '">' . $u->get('name') . '</a>';
        } else {
            $from = Lang::txt('PLG_MEMBERS_MESSAGES_SYSTEM', $component);
        }
        //date received
        $date = Date::of($row->created)->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
        //delete link
        $del_link = Route::url($this->member->link() . '&active=messages&mid[]=' . $row->id . '&action=sendtotrash&activetab=archive&' . Session::getFormToken() . '=1');
        $delete = '<a title="' . Lang::txt('PLG_MEMBERS_MESSAGES_REMOVE_MESSAGE') . '" class="trash" href="' . $del_link . '">' . Lang::txt('PLG_MEMBERS_MESSAGES_TRASH') . '</a>';
        ?>

					<tr>
						<td class="check"><?php 
        echo $check;
        ?>
</td>
						<td class="status"><?php 
        echo $status;
        ?>
</td>
						<td><?php 
示例#25
0
    ?>
:</div>
								<div class="small-content">
									<?php 
    echo $record->time;
    ?>
								</div>
							</div>
							<div class="td">
								<div class="small-label"><?php 
    echo Lang::txt('COM_TIME_RECORDS_DATE');
    ?>
:</div>
								<div class="small-content">
									<?php 
    echo Date::of($record->date)->toLocal('m/d/y');
    ?>
								</div>
							</div>
							<div class="td">
								<div class="small-label"><?php 
    echo Lang::txt('COM_TIME_RECORDS_TASK');
    ?>
:</div>
								<div class="small-content">
									<?php 
    echo String::highlight($record->task->name, $this->filters['search'], array('html' => true));
    ?>
								</div>
							</div>
							<div class="td last" title="<?php 
示例#26
0
$filterstring = $this->filters['sortby'] ? '&amp;sort=' . $this->filters['sortby'] : '';
$filterstring .= '&amp;status=' . $this->filters['status'];
$filterstring .= $this->filters['category'] ? '&amp;category=' . $this->filters['category'] : '';
for ($i = 0, $n = count($this->rows); $i < $n; $i++) {
    $row = $this->rows[$i];
    // Build some publishing info
    $info = Lang::txt('COM_PUBLICATIONS_FIELD_CREATED') . ': ' . $row->created . '<br />';
    $info .= Lang::txt('COM_PUBLICATIONS_FIELD_CREATOR') . ': ' . $this->escape($row->created_by) . '<br />';
    // Get the published status
    $now = Date::toSql();
    // See if it's checked out or not
    $checked = '';
    $checkedInfo = '';
    if ($row->checked_out || $row->checked_out_time != '0000-00-00 00:00:00') {
        $date = Date::of($row->checked_out_time)->toLocal(Lang::txt('DATE_FORMAT_LC1'));
        $time = Date::of($row->checked_out_time)->toLocal('H:i');
        $checked = '<span class="editlinktip hasTip" title="' . Lang::txt('JLIB_HTML_CHECKED_OUT') . '::' . $this->escape($row->checked_out) . '<br />' . $date . '<br />' . $time . '">';
        $checked .= Html::asset('image', 'admin/checked_out.png', null, null, true) . '</span>';
        $info .= $row->checked_out_time != '0000-00-00 00:00:00' ? Lang::txt('COM_PUBLICATIONS_FIELD_CHECKED_OUT') . ': ' . $date . '<br />' : '';
        $info .= $row->checked_out ? Lang::txt('COM_PUBLICATIONS_FIELD_CHECKED_OUT_BY') . ': ' . $row->checked_out . '<br />' : '';
        $checkedInfo = ' [' . Lang::txt('COM_PUBLICATIONS_FIELD_CHECKED_OUT') . ']';
    } else {
        $checked = Html::grid('id', $i, $row->id, false, 'id');
    }
    // What's the publication status?
    $status = $this->model->getStatusName($row->state);
    $class = $this->model->getStatusCss($row->state);
    $date = $row->modified() ? $row->modified('datetime') : $row->created('datetime');
    ?>
			<tr class="<?php 
    echo "row{$k}";
示例#27
0
 /**
  * Special formatting for results
  *
  * @param      object $row    Database row
  * @param      string $period Time period
  * @return     string
  */
 public static function out($row, $period)
 {
     $database = App::get('db');
     $helper = new \Components\Resources\Helpers\Helper($row->id, $database);
     // Instantiate a helper object
     if (!isset($row->authors)) {
         $helper->getContributors();
         $row->authors = $helper->contributors;
     }
     // Get the component params and merge with resource params
     $config = Component::params('com_resources');
     $rparams = new \Hubzero\Config\Registry($row->params);
     // Set the display date
     switch ($rparams->get('show_date', $config->get('show_date'))) {
         case 0:
             $thedate = '';
             break;
         case 1:
             $thedate = Date::of($row->created)->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
             break;
         case 2:
             $thedate = Date::of($row->modified)->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
             break;
         case 3:
             $thedate = Date::of($row->publish_up)->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
             break;
     }
     // Start building HTML
     $html = "\t" . '<li class="resource">' . "\n";
     $html .= "\t\t" . '<p class="title"><a href="' . $row->href . '">' . stripslashes($row->title) . '</a></p>' . "\n";
     if ($rparams->get('show_ranking', $config->get('show_ranking'))) {
         $helper->getCitationsCount();
         $helper->getLastCitationDate();
         if ($row->area == 'Tools') {
             $stats = new \Components\Resources\Helpers\Usage\Stats($database, $row->id, $row->category, $row->rating, $helper->citationsCount, $helper->lastCitationDate);
         } else {
             $stats = new \Components\Resources\Helpers\Usage\Andmore($database, $row->id, $row->category, $row->rating, $helper->citationsCount, $helper->lastCitationDate);
         }
         $statshtml = $stats->display();
         $row->ranking = round($row->ranking, 1);
         $html .= "\t\t" . '<div class="metadata">' . "\n";
         $r = 10 * $row->ranking;
         if (intval($r) < 10) {
             $r = '0' . $r;
         }
         $html .= "\t\t\t" . '<dl class="rankinfo">' . "\n";
         $html .= "\t\t\t\t" . '<dt class="ranking"><span class="rank-' . $r . '">' . Lang::txt('PLG_WHATSNEW_RESOURCES_THIS_HAS') . '</span> ' . number_format($row->ranking, 1) . ' ' . Lang::txt('PLG_WHATSNEW_RESOURCES_RANKING') . '</dt>' . "\n";
         $html .= "\t\t\t\t" . '<dd>' . "\n";
         $html .= "\t\t\t\t\t" . '<p>' . Lang::txt('PLG_WHATSNEW_RESOURCES_RANKING_EXPLANATION') . '</p>' . "\n";
         $html .= "\t\t\t\t\t" . '<div>' . "\n";
         $html .= $statshtml;
         $html .= "\t\t\t\t\t" . '</div>' . "\n";
         $html .= "\t\t\t\t" . '</dd>' . "\n";
         $html .= "\t\t\t" . '</dl>' . "\n";
         $html .= "\t\t" . '</div>' . "\n";
     } elseif ($rparams->get('show_rating', $config->get('show_rating'))) {
         switch ($row->rating) {
             case 0.5:
                 $class = ' half-stars';
                 break;
             case 1:
                 $class = ' one-stars';
                 break;
             case 1.5:
                 $class = ' onehalf-stars';
                 break;
             case 2:
                 $class = ' two-stars';
                 break;
             case 2.5:
                 $class = ' twohalf-stars';
                 break;
             case 3:
                 $class = ' three-stars';
                 break;
             case 3.5:
                 $class = ' threehalf-stars';
                 break;
             case 4:
                 $class = ' four-stars';
                 break;
             case 4.5:
                 $class = ' fourhalf-stars';
                 break;
             case 5:
                 $class = ' five-stars';
                 break;
             case 0:
             default:
                 $class = ' no-stars';
                 break;
         }
         $html .= "\t\t" . '<div class="metadata">' . "\n";
         $html .= "\t\t\t" . '<p class="rating"><span class="avgrating' . $class . '"><span>' . Lang::txt('PLG_WHATSNEW_RESOURCES_OUT_OF_5_STARS', $row->rating) . '</span>&nbsp;</span></p>' . "\n";
         $html .= "\t\t" . '</div>' . "\n";
     }
     $html .= "\t\t" . '<p class="details">' . $thedate . ' <span>|</span> ' . $row->area;
     if ($row->authors) {
         $html .= ' <span>|</span> ' . Lang::txt('PLG_WHATSNEW_RESOURCES_CONTRIBUTORS') . ' ' . $row->authors;
     }
     $html .= '</p>' . "\n";
     if ($row->itext) {
         $html .= "\t\t" . '<p>' . \Hubzero\Utility\String::truncate(strip_tags(stripslashes($row->itext)), 200) . '</p>' . "\n";
     } else {
         if ($row->ftext) {
             $html .= "\t\t" . '<p>' . \Hubzero\Utility\String::truncate(strip_tags(stripslashes($row->ftext)), 200) . '</p>' . "\n";
         }
     }
     $html .= "\t\t" . '<p class="href">' . Request::base() . trim($row->href, '/') . '</p>' . "\n";
     $html .= "\t" . '</li>' . "\n";
     // Return output
     return $html;
 }
示例#28
0
    default:
        $policy = Lang::txt('COM_GROUPS_MEMBERSHIP_SETTINGS_OPEN_SETTING');
        break;
}
// Determine the discoverability
switch ($this->group->get('discoverability')) {
    case 1:
        $discoverability = Lang::txt('COM_GROUPS_DISCOVERABILITY_SETTINGS_HIDDEN_SETTING');
        break;
    case 0:
    default:
        $discoverability = Lang::txt('COM_GROUPS_DISCOVERABILITY_SETTINGS_VISIBLE_SETTING');
        break;
}
// use created date
$created = Date::of($this->group->get('created'))->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
?>

<?php 
if (!$no_html) {
    ?>
	<header id="content-header">
		<h2><?php 
    echo $this->escape($this->group->get('description'));
    ?>
</h2>

		<dl>
			<dt><?php 
    echo Lang::txt('COM_GROUPS_INFO_DISCOVERABILITY');
    ?>
示例#29
0
 /**
  * Return a formatted timestamp
  *
  * @param      string $as What format to return
  * @return     string
  */
 public function created($as = '')
 {
     switch (strtolower($as)) {
         case 'date':
             return Date::of($this->get('added'))->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
             break;
         case 'time':
             return Date::of($this->get('added'))->toLocal(Lang::txt('TIME_FORMAT_HZ1'));
             break;
         default:
             return $this->get('added');
             break;
     }
 }
示例#30
0
 /**
  * Generates automatic owned logged date/time
  *
  * @param   array  $data  The data being saved
  * @return  string
  **/
 public function automaticLogged($data)
 {
     return \Date::of()->toSql();
 }