Example #1
0
 /**
  * Highlight some text
  *
  * @param   string   $text     Text to find phrases in
  * @param   integer  $phrase   Phrase to highlight
  * @param   array    $options  Options for highlighting
  * @return  string
  * @throws  \InvalidArgumentException If no text was passed
  */
 public function __invoke($text = null, $phrase = null, $options = array())
 {
     if (null === $text) {
         throw new \InvalidArgumentException(__METHOD__ . '(); No text passed.');
     }
     return String::highlight($text, $phrase, $options);
 }
Example #2
0
 /**
  * Obfuscate some text
  *
  * @param   string  $text  Text to obfuscate
  * @return  string
  * @throws  \InvalidArgumentException If no text passed
  */
 public function __invoke($text = null)
 {
     if (null === $text) {
         throw new \InvalidArgumentException(__METHOD__ . '(); No text passed.');
     }
     return String::obfuscate($text);
 }
Example #3
0
 /**
  * Truncate some text
  *
  * @param   string   $text     Text to truncate
  * @param   integer  $length   Length to truncate to
  * @param   array    $options  Options
  * @return  string
  * @throws  \InvalidArgumentException If no text is passed or length isn't a positive integer
  */
 public function __invoke($text = null, $length = null, $options = array())
 {
     if (null === $text) {
         throw new \InvalidArgumentException(__METHOD__ . '(); No text passed.');
     }
     if (!$length || !is_numeric($length)) {
         throw new \InvalidArgumentException(__METHOD__ . '(); Length must be an integer');
     }
     return String::truncate($text, $length, $options);
 }
Example #4
0
 /**
  * Constructor
  *
  * @param      integer $scope_id Scope ID (group, course, etc.)
  * @return     void
  */
 public function __construct($scope_id = 0)
 {
     $this->set('scope_id', $scope_id);
     $this->_segments['id'] = $scope_id;
     $this->_segments['active'] = 'blog';
     $this->_item = Profile::getInstance($scope_id);
     $config = Plugin::params('members', 'blog');
     $id = String::pad($this->get('scope_id'));
     $this->set('path', str_replace('{{uid}}', $id, $config->get('uploadpath', '/site/members/{{uid}}/blog')));
     $this->set('scope', $this->get('scope_id') . '/blog');
     $this->set('option', $this->_segments['option']);
 }
Example #5
0
 /**
  * Validate data
  *
  * @return  boolean  True if data is valid
  */
 public function check()
 {
     $this->message = trim($this->message);
     if ($this->message == '') {
         $this->setError(Lang::txt('SUPPORT_ERROR_BLANK_FIELD'));
         return false;
     }
     $this->title = trim($this->title);
     if (!$this->title) {
         $this->title = String::truncate($this->message, 250);
     }
     return true;
 }
Example #6
0
 /**
  * Constructor
  *
  * @param   integer  $scope_id  Scope ID (group, course, etc.)
  * @return  void
  */
 public function __construct($scope_id = 0)
 {
     $this->set('scope_id', $scope_id);
     include_once PATH_CORE . DS . 'components' . DS . 'com_courses' . DS . 'models' . DS . 'courses.php';
     $offering = \Components\Courses\Models\Offering::getInstance($this->get('scope_id'));
     $course = \Components\Courses\Models\Course::getInstance($offering->get('course_id'));
     $this->_segments['gid'] = $course->get('alias');
     $this->_segments['offering'] = $offering->alias();
     $this->_segments['active'] = 'discussions';
     if (Request::getVar('active') == 'outline') {
         $this->_segments['active'] = 'outline';
     }
     $this->_name = String::truncate($course->get('alias'), 50) . ': ' . String::truncate($offering->get('alias'), 50);
 }
Example #7
0
 /**
  * Parse Document Content
  *
  * @return  void
  */
 public function parse()
 {
     // check to make sure we have content
     if (!$this->get('document')) {
         App::abort(406, '\\Components\\Groups\\Helpers\\Document: Requires document to parse');
     }
     // parse content
     // get all group includes
     if (preg_match_all('#<group:include([^>]*)/>#', $this->get('document'), $matches)) {
         // get number of matches
         $count = count($matches[1]);
         //loop through each match
         for ($i = 0; $i < $count; $i++) {
             $attribs = String::parseAttributes($matches[1][$i]);
             $type = isset($attribs['type']) ? strtolower(trim($attribs['type'])) : null;
             $name = isset($attribs['name']) ? $attribs['name'] : $type;
             unset($attribs['type']);
             $params = $attribs;
             $this->_tags[$matches[0][$i]] = array('type' => $type, 'name' => $name, 'params' => $params);
         }
     }
     // return this
     return $this;
 }
Example #8
0
 /**
  * Get the content of the entry
  *
  * @param	   string  $as		Format to return state in [text, number]
  * @param	   integer $shorten Number of characters to shorten text to
  * @return	   string
  */
 public function content($as = 'parsed', $shorten = 0)
 {
     $as = strtolower($as);
     $options = array();
     switch ($as) {
         case 'parsed':
             $content = $this->get('comment.parsed', null);
             if ($content === null) {
                 $config = array('option' => $this->get('option', 'com_projects'), 'scope' => $this->get('scope'), 'pagename' => $this->get('alias'), 'pageid' => 0, 'filepath' => $this->get('path'), 'domain' => '');
                 $content = str_replace(array('\\"', "\\'"), array('"', "'"), (string) $this->get('comment', ''));
                 $this->importPlugin('content')->trigger('onContentPrepare', array($this->_context, &$this, &$config));
                 $this->set('comment.parsed', (string) $this->get('comment', ''));
                 $this->set('comment', $content);
                 return $this->content($as, $shorten);
             }
             $options['html'] = true;
             break;
         case 'clean':
             $content = strip_tags($this->content('parsed'));
             break;
         case 'raw':
         default:
             $content = str_replace(array('\\"', "\\'"), array('"', "'"), $this->get('comment'));
             $content = preg_replace('/^(<!-- \\{FORMAT:.*\\} -->)/i', '', $content);
             break;
     }
     if ($shorten) {
         $content = \Hubzero\Utility\String::truncate($content, $shorten, $options);
     }
     return $content;
 }
Example #9
0
 /**
  * Retrieves a row from the database
  *
  * @param      string $refid    ID of the database table row
  * @param      string $category Element type (determines table to look in)
  * @param      string $parent   If the element has a parent element
  * @return     array
  */
 public function transferItem($from_type, $from_id, $to_type, $rid = 0, $deactivate = 1)
 {
     $upconfig = Component::params('com_members');
     $this->banking = $upconfig->get('bankAccounts');
     $database = App::get('db');
     if ($from_type == NULL or $from_id == NULL or $to_type == NULL) {
         $this->setError(Lang::txt('PLG_SUPPORT_TRANSFER_ERROR_MISSING_INFO'));
         return false;
     }
     if ($from_type == $to_type) {
         $this->setError(Lang::txt('PLG_SUPPORT_TRANSFER_ERROR_CATEGORIES_MUST_BE_DIFFERENT'));
         return false;
     }
     // collectors
     $author = '';
     $subject = '';
     $body = '';
     $tags = '';
     $owner = '';
     // name of group owning the item
     $anonymous = 0;
     // get needed scripts
     include_once PATH_CORE . DS . 'components' . DS . 'com_support' . DS . 'models' . DS . 'ticket.php';
     include_once PATH_CORE . DS . 'components' . DS . 'com_answers' . DS . 'models' . DS . 'question.php';
     include_once PATH_CORE . DS . 'components' . DS . 'com_wishlist' . DS . 'models' . DS . 'wishlist.php';
     $wconfig = Component::params('com_wishlist');
     $admingroup = $wconfig->get('group') ? $wconfig->get('group') : 'hubadmin';
     // Get needed scripts & initial data
     switch ($from_type) {
         // Transfer from a Support Ticket
         case 'ticket':
             $row = new \Components\Support\Models\Ticket($from_id);
             if ($row->exists()) {
                 $author = $row->get('login');
                 $subject = $row->content('raw', 200);
                 // max 200 characters
                 $body = $row->get('summary');
                 $owner = $row->get('group');
                 // If we are de-activating original item
                 if ($deactivate) {
                     $row->set('status', 2);
                     $row->set('resolved', 'transfered');
                 }
                 $tags = $row->tags('string');
             } else {
                 $this->setError(Lang::txt('PLG_SUPPORT_TRANSFER_ERROR_ITEM_NOT_FOUND'));
                 return false;
             }
             break;
             // Transfer from a Question
         // Transfer from a Question
         case 'question':
             $row = new \Components\Answers\Models\Question($from_id);
             if ($row->exists()) {
                 $author = $row->get('created_by');
                 $subject = $row->subject('raw', 200);
                 // max 200 characters
                 $body = $row->get('question');
                 $anonymous = $row->get('anonymous');
                 // If we are de-activating original item
                 if ($deactivate) {
                     $row->set('state', 2);
                     $row->set('reward', 0);
                 }
                 $tags = $row->tags('string');
             } else {
                 $this->setError(Lang::txt('PLG_SUPPORT_TRANSFER_ERROR_ITEM_NOT_FOUND'));
                 return false;
             }
             break;
             // Transfer from a Wish
         // Transfer from a Wish
         case 'wish':
             $row = new \Components\Wishlist\Tables\Wish($database);
             $row->load($from_id);
             if ($row->id) {
                 $author = $row->proposed_by;
                 $subject = \Hubzero\Utility\String::truncate($row->subject, 200);
                 // max 200 characters
                 $body = $row->about;
                 $anonymous = $row->anonymous;
                 // If we are de-activating original item
                 if ($deactivate) {
                     $row->status = 2;
                     $row->ranking = 0;
                     // also delete all previous votes for this wish
                     $objR = new \Components\Wishlist\Tables\Rank($database);
                     $objR->remove_vote($from_id);
                 }
                 // get owner
                 $objG = new \Components\Wishlist\Tables\OwnerGroup($database);
                 $nativegroups = $objG->get_owner_groups($row->wishlist, $admingroup, '', 1);
                 $owner = count($nativegroups) > 0 && $nativegroups[0] != $admingroup ? $nativegroups[0] : '';
                 // tool group
                 $objWishlist = new \Components\Wishlist\Tables\Wishlist($database);
                 $wishlist = $objWishlist->get_wishlist($row->wishlist);
                 if (isset($wishlist->resource) && isset($wishlist->resource->alias)) {
                     $tags = $wishlist->resource->type == 7 ? 'tool:' : 'resource:';
                     $tags .= $wishlist->resource->alias ? $wishlist->resource->alias : $wishlist->referenceid;
                 }
             } else {
                 $this->setError(Lang::txt('PLG_SUPPORT_TRANSFER_ERROR_ITEM_NOT_FOUND'));
                 return false;
             }
             break;
     }
     // if no author can be found, use current administrator
     $author = User::getInstance($author);
     if (!is_object($author)) {
         $author = User::getInstance(User::get('id'));
     }
     $today = Date::toSql();
     // Where do we transfer?
     switch ($to_type) {
         // Transfer to a Support Ticket
         case 'ticket':
             $newrow = new \Components\Support\Models\Ticket();
             $newrow->set('open', 1);
             $newrow->set('status', 0);
             $newrow->set('created', $today);
             $newrow->set('login', $author->get('username'));
             $newrow->set('severity', 'normal');
             $newrow->set('summary', $subject);
             $newrow->set('report', $body ? $body : $subject);
             $newrow->set('section', 1);
             $newrow->set('type', 0);
             $newrow->set('instances', 1);
             $newrow->set('email', $author->get('email'));
             $newrow->set('name', $author->get('name'));
             // do we have an owner group?
             $newrow->set('group', $owner ? $owner : '');
             break;
         case 'question':
             $newrow = new \Components\Answers\Models\Question();
             $newrow->set('subject', $subject);
             $newrow->set('question', $body);
             $newrow->set('created', $today);
             $newrow->set('created_by', $author->get('id'));
             $newrow->set('state', 0);
             $newrow->set('anonymous', $anonymous);
             break;
         case 'wish':
             $newrow = new \Components\Wishlist\Models\Wish();
             $newrow->set('subject', $subject);
             $newrow->set('about', $body);
             $newrow->set('proposed', $today);
             $newrow->set('proposed_by', $author->get('id'));
             $newrow->set('status', 0);
             $newrow->set('anonymous', $anonymous);
             // which wishlist?
             $objWishlist = new \Components\Wishlist\Tables\Wishlist($database);
             $mainlist = $objWishlist->get_wishlistID(1, 'general');
             $listid = 0;
             if (!$rid && $owner) {
                 $rid = $this->getResourceIdFromGroup($owner);
             }
             if ($rid) {
                 $listid = $objWishlist->get_wishlistID($rid);
             }
             $newrow->set('wishlist', $listid ? $listid : $mainlist);
             break;
     }
     // Save new information
     if (!$newrow->store()) {
         $this->setError($newrow->getError());
         return;
     } else {
         // Checkin ticket
         //$newrow->checkin();
         // Extras
         if ($newrow->exists()) {
             switch ($to_type) {
                 case 'ticket':
                     // Tag new ticket
                     if ($tags) {
                         $newrow->tag($tags, User::get('id'), 0);
                     }
                     break;
                 case 'question':
                     // Tag new question
                     if ($tags) {
                         $newrow->tag($tags, User::get('id'), 0);
                     }
                     break;
             }
         }
     }
     // If we are de-activating original item
     if ($deactivate) {
         // overwrite old entry
         if (!$row->store()) {
             $this->setError($row->getError());
             exit;
         }
         // Clean up rewards if banking
         if ($this->banking) {
             switch ($from_type) {
                 case 'ticket':
                     // no banking yet
                     break;
                 case 'question':
                     $reward = \Hubzero\Bank\Transaction::getAmount('answers', 'hold', $from_id, $author->get('id'));
                     // Remove hold
                     if ($reward) {
                         \Hubzero\Bank\Transaction::deleteRecords('answers', 'hold', $from_id);
                         // Make credit adjustment
                         $BTL_Q = new \Hubzero\Bank\Teller($author->get('id'));
                         $credit = $BTL_Q->credit_summary();
                         $adjusted = $credit - $reward;
                         $BTL_Q->credit_adjustment($adjusted);
                     }
                     break;
                 case 'wish':
                     include_once PATH_CORE . DS . 'components' . DS . 'com_wishlist' . DS . 'helpers' . DS . 'economy.php';
                     $WE = new \Components\Wishlist\Helpers\Economy($database);
                     $WE->cleanupBonus($from_id);
                     break;
             }
         }
     }
     return $newrow->get('id');
 }
Example #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;
     }
 }
Example #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;
 }
Example #12
0
}
?>
	<?php 
if ($this->row->isComplete()) {
    ?>
 &raquo; <span class="indlist completedtd"><a href="<?php 
    echo Route::url($url) . '/?state=1';
    ?>
"><?php 
    echo ucfirst(Lang::txt('PLG_PROJECTS_TODO_COMPLETED'));
    ?>
</a></span> <?php 
}
?>
	&raquo; <span class="itemname"><?php 
echo \Hubzero\Utility\String::truncate($this->row->get('content'), 60);
?>
</span>
	</h3>
</div>

<div class="pinboard">
		<section class="section intropage">
			<div class="grid">
				<div class="col span8">
					<div id="td-item" class="<?php 
echo $class;
?>
">
						<span class="pin">&nbsp;</span>
						<div class="todo-content">
Example #13
0
				<?php 
    if ($this->params->get('access_email', 2) == 0 || $this->params->get('access_email', 2) == 1 && $loggedin || $this->params->get('access_email', 2) == 2 && $isUser) {
        ?>
					<li class="profile-email field">
						<div class="field-content">
							<div class="key"><?php 
        echo Lang::txt('PLG_GROUPS_PROFILE_EMAIL');
        ?>
</div>
							<div class="value">
								<a class="email" href="mailto:<?php 
        echo \Hubzero\Utility\String::obfuscate($this->profile->get('email'));
        ?>
" rel="nofollow">
									<?php 
        echo \Hubzero\Utility\String::obfuscate($this->profile->get('email'));
        ?>
								</a>
							</div>
						</div>
					</li>
				<?php 
    }
    ?>
			<?php 
}
?>

			<?php 
if ($this->registration->ORCID != REG_HIDE && $this->profile->get('orcid')) {
    ?>
Example #14
0
				</td>
				<td>
					<span class="<?php 
    echo $class;
    ?>
 hasTip" title="<?php 
    echo $status;
    ?>
">&nbsp;</span>
				</td>
				<td>
					<a href="<?php 
    echo Route::url('index.php?option=com_projects&task=edit&id[]=' . $row->project_id);
    ?>
"><?php 
    echo \Hubzero\Utility\String::truncate($row->project_title, 50);
    ?>
</a>
				</td>
				<td>
					<a href="<?php 
    echo Route::url('index.php?option=' . $this->option . '&controller=' . $this->controller . '&task=versions&id=' . $row->id . $filterstring);
    ?>
"><?php 
    echo $this->escape($row->versions);
    ?>
</a>
				</td>
				<td>
					<?php 
    echo $this->escape($row->base);
Example #15
0
                        $html .= "\t\t\t" . '<td>' . $breeze . '</td>' . "\n";
                    }
                    $html .= "\t\t\t" . '<td>' . $videoi . '</td>' . "\n";
                    $html .= "\t\t\t" . '<td>' . $pdf . '</td>' . "\n";
                    $html .= "\t\t\t" . '<td>' . $supp . '</td>' . "\n";
                    $html .= "\t\t\t" . '<td>' . $exercises . '</td>' . "\n";
                } else {
                    //$html .= "\t\t\t".'<td colspan="5">'.Lang::txt('Currently unavilable').'</td>'."\n";
                    $html .= "\t\t\t" . '<td colspan="5"> </td>' . "\n";
                }
                $html .= "\t\t" . '</tr>' . "\n";
                if ($child->standalone == 1) {
                    if ($child->type != 31 && $child->introtext) {
                        $html .= "\t\t" . '<tr class="' . $o . '">' . "\n";
                        $html .= "\t\t\t" . '<td colspan="6">';
                        $html .= \Hubzero\Utility\String::truncate(stripslashes($child->introtext), 200) . '<br /><br />';
                        $html .= "\t\t\t" . '</td>' . "\n";
                        $html .= "\t\t" . '</tr>' . "\n";
                    }
                }
            }
            echo $html;
            ?>
				</tbody>
			</table>
			<?php 
        }
    }
    ?>
	</section><!-- / .main section -->
<?php 
Example #16
0
$html = '<h3>' . $this->escape(stripslashes($name)) . ' <span>(' . Lang::txt('COM_TAGS_RESULTS_THROUGH_OF', $this->filters['start'] + 1, $ttl, $total) . ')</span></h3>' . "\n";
if ($this->results) {
    $html .= '<ol class="results">' . "\n";
    foreach ($this->results as $row) {
        $obj = 'plgTags' . ucfirst($row->section);
        if (method_exists($obj, 'out')) {
            $html .= call_user_func(array($obj, 'out'), $row);
        } else {
            // @todo accomodate scope (aka) group citations
            if (strstr($row->href, 'index.php')) {
                $row->href = Route::url($row->href);
            }
            $html .= "\t" . '<li>' . "\n";
            $html .= "\t\t" . '<p class="title"><a href="' . $row->href . '">' . \Hubzero\Utility\Sanitize::clean($row->title) . '</a></p>' . "\n";
            if ($row->ftext) {
                $html .= "\t\t" . '<p>' . \Hubzero\Utility\String::truncate(strip_tags($row->ftext), 200) . "</p>\n";
            }
            $html .= "\t\t" . '<p class="href">' . $base . $row->href . '</p>' . "\n";
            $html .= "\t" . '</li>' . "\n";
        }
    }
    $html .= '</ol>' . "\n";
} else {
    $html = '<p class="warning">' . Lang::txt('COM_TAGS_NO_RESULTS') . '</p>';
}
echo $html;
?>
				</div><!-- / .container-block -->
				<?php 
$pageNav = $this->pagination($total, $this->filters['start'], $this->filters['limit']);
$pageNav->setAdditionalUrlParam('task', '');
Example #17
0
defined('_HZEXEC_') or die;
// Get block/element properties
$props = $this->pub->curation('blocks', $this->master->blockId, 'props') . '-' . $this->elementId;
$complete = $this->pub->curation('blocks', $this->master->blockId, 'elementStatus', $this->elementId);
$required = $this->pub->curation('blocks', $this->master->blockId, 'elements', $this->elementId)->params->required;
$elName = 'content-element' . $this->elementId;
$max = $this->manifest->params->max;
$multiZip = isset($this->manifest->params->typeParams->multiZip) && $this->manifest->params->typeParams->multiZip == 0 ? false : true;
// Customize title
$defaultTitle = $this->manifest->params->title ? str_replace('{pubtitle}', $this->pub->title, $this->manifest->params->title) : NULL;
$defaultTitle = $this->manifest->params->title ? str_replace('{pubversion}', $this->pub->version_label, $defaultTitle) : NULL;
$error = $this->status->getError();
$aboutTxt = $this->manifest->adminTips ? $this->manifest->adminTips : $this->manifest->about;
$shorten = $aboutTxt && strlen($aboutTxt) > 200 ? 1 : 0;
if ($shorten) {
    $about = \Hubzero\Utility\String::truncate($aboutTxt, 200);
    $about .= ' <a href="#more-' . $elName . '" class="more-content">' . Lang::txt('COM_PUBLICATIONS_READ_MORE') . '</a>';
    $about .= ' <div class="hidden">';
    $about .= ' 	<div class="full-content" id="more-' . $elName . '">' . $aboutTxt . '</div>';
    $about .= ' </div>';
} else {
    $about = $aboutTxt;
}
// Get version params and extract bundle name
$bundleName = $this->pub->params->get($elName . 'bundlename', $defaultTitle);
$bundleName = $bundleName ? $bundleName : 'bundle';
$bundleName .= '.zip';
// Get attachment model
$modelAttach = new \Components\Publications\Models\Attachments($this->database);
// Get handler model
$modelHandler = new \Components\Publications\Models\Handlers($this->database);
Example #18
0
</time></span>
								<span class="comment-date-on"><?php 
            echo Lang::txt('COM_BLOG_ON');
            ?>
</span>
								<span class="date"><time datetime="<?php 
            echo $replyto->get('created');
            ?>
"><?php 
            echo $replyto->created('date');
            ?>
</time></span>
							</p>
							<p>
								<?php 
            echo \Hubzero\Utility\String::truncate(stripslashes($replyto->get('content')), 300);
            ?>
							</p>
						</blockquote>
						<?php 
        }
    }
    ?>

					<?php 
    if (!User::isGuest()) {
        ?>
						<label for="commentcontent">
							Your <?php 
        echo $replyto->get('id') ? 'reply' : 'comments';
        ?>
Example #19
0
 /**
  * On after approve/kickback
  *
  * @return  void
  */
 public function onAfterStatusChange()
 {
     if ($this->getError()) {
         return;
     }
     $pub = $this->_pub;
     $status = $this->_pub->version->state;
     $activity = $status == 1 ? Lang::txt('COM_PUBLICATIONS_CURATION_ACTIVITY_PUBLISHED') : Lang::txt('COM_PUBLICATIONS_CURATION_ACTIVITY_KICKBACK');
     $pubtitle = \Hubzero\Utility\String::truncate($pub->title, 100);
     // Log activity in curation history
     $pub->_curationModel->saveHistory(User::get('id'), $pub->state, $status, 1);
     // Add activity
     $activity .= ' ' . strtolower(Lang::txt('version')) . ' ' . $pub->version_label . ' ' . Lang::txt('COM_PUBLICATIONS_OF') . ' ' . strtolower(Lang::txt('publication')) . ' "' . $pubtitle . '" ';
     // Record activity
     $aid = $pub->project()->recordActivity($activity, $pub->id, $pubtitle, $pub->link('version'), 'publication', 0, $admin = 1);
     // Start message
     $sef = 'publications' . DS . $pub->id . DS . $pub->version_number;
     $link = rtrim(Request::base(), DS) . DS . trim($pub->link('version'), DS);
     $manage = rtrim(Request::base(), DS) . DS . trim($pub->link('editversion'), DS);
     $message = $status == 1 ? Lang::txt('COM_PUBLICATIONS_CURATION_EMAIL_CURATOR_APPROVED') : Lang::txt('COM_PUBLICATIONS_CURATION_EMAIL_CURATOR_KICKED_BACK');
     if ($status != 1) {
         $message .= "\n" . "\n";
         $message .= Lang::txt('COM_PUBLICATIONS_CURATION_TAKE_ACTION') . ' ' . $manage;
     } else {
         $message .= ' ' . $link;
     }
     $pubtitle = \Hubzero\Utility\String::truncate($pub->title, 100);
     $subject = ucfirst(Lang::txt('COM_PUBLICATIONS_CURATION_VERSION')) . ' ' . $pub->version_label . ' ' . Lang::txt('COM_PUBLICATIONS_OF') . ' ' . strtolower(Lang::txt('COM_PUBLICATIONS_PUBLICATION')) . ' "' . $pubtitle . '" ';
     $subject .= $status == 1 ? Lang::txt('COM_PUBLICATIONS_MSG_ADMIN_PUBLISHED') : Lang::txt('COM_PUBLICATIONS_MSG_ADMIN_KICKED_BACK');
     // Get authors
     $authors = $pub->table('Author')->getAuthors($pub->version_id, 1, 1, 1);
     // No authors – send to publication creator
     if (count($authors) == 0) {
         $authors = array($pub->created_by);
     }
     // New version released?
     if ($status == 1 && $pub->get('version_number') > 1) {
         // Notify subsrcibers
         Event::trigger('publications.onWatch', array($pub));
     }
     // Make sure there are no duplicates
     $authors = array_unique($authors);
     // Notify authors
     Helpers\Html::notify($pub, $authors, $subject, $message, true);
     return;
 }
Example #20
0
echo $this->pub->id;
?>
" />
		<input type="hidden" name="vid" value="<?php 
echo $this->pub->version_id;
?>
" />
		<input type="hidden" name="task" id="task" value="save" />
	</fieldset>
<div class="curation-wrap">
	<div class="pubtitle">
		<h3><span class="restype indlist"><?php 
echo $typetitle;
?>
</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');
?>
Example #21
0
 /**
  * Static method for formatting results
  *
  * @param      object $row Database row
  * @return     string HTML
  */
 public function out($row)
 {
     $row->href = Route::url('index.php?option=com_kb&section=' . $row->data2 . '&category=' . $row->data1 . '&alias=' . $row->alias);
     // Start building the HTML
     $html = "\t" . '<li class="kb-entry">' . "\n";
     $html .= "\t\t" . '<p class="title"><a href="' . $row->href . '">' . stripslashes($row->title) . '</a></p>' . "\n";
     if ($row->ftext) {
         $html .= "\t\t" . '<p>' . \Hubzero\Utility\String::truncate(\Hubzero\Utility\Sanitize::stripAll(stripslashes($row->ftext)), 200) . "</p>\n";
     }
     $html .= "\t\t" . '<p class="href">' . Request::base() . ltrim($row->href, '/') . '</p>' . "\n";
     $html .= "\t" . '</li>' . "\n";
     // Return output
     return $html;
 }
Example #22
0
									<?php 
    echo String::highlight($record->task->name, $this->filters['search'], array('html' => true));
    ?>
								</div>
							</div>
							<div class="td last" title="<?php 
    echo $record->description;
    ?>
">
								<div class="small-label"><?php 
    echo Lang::txt('COM_TIME_RECORDS_DESCRIPTION');
    ?>
:</div>
								<div class="small-content">
									<?php 
    echo String::highlight(String::truncate($record->description, 25), $this->filters['search'], array('html' => true));
    ?>
								</div>
							</div>
						</div>
					<?php 
}
?>
					<?php 
if (!$this->records->count()) {
    ?>
						<div class="tr">
							<div colspan="7" class="td no_records"><?php 
    echo Lang::txt('COM_TIME_RECORDS_NONE_TO_DISPLAY');
    ?>
</div>
Example #23
0
 public function formatted($config = array('format' => 'apa'), $highlight = NULL)
 {
     //get hub specific details
     $hub_name = \Config::get('sitename');
     $hub_url = rtrim(\Request::base(), '/');
     //get scope specific details
     $coins_only = isset($config['coins_only']) ? $config['coins_only'] : "no";
     $include_coins = isset($config['include_coins']) ? $config['include_coins'] : "no";
     $c_type = 'journal';
     $type = $this->relatedType->type;
     switch (strtolower($type)) {
         case 'book':
         case 'inbook':
         case 'conference':
         case 'proceedings':
         case 'inproceedings':
             $c_type = "book";
             break;
         case 'journal':
         case 'article':
         case 'journal article':
             $c_type = "journal";
             break;
         default:
             break;
     }
     //var to hold COinS data
     $coins_data = array("ctx_ver=Z39.88-2004", "rft_val_fmt=info:ofi/fmt:kev:mtx:{$c_type}", "rfr_id=info:sid/{$hub_url}:{$hub_name}");
     //array to hold replace vals
     $replace_values = array();
     // get the template
     // default to IEEE
     try {
         $format = \Components\Citations\Models\Format::oneOrFail($config['citationFormat']);
     } catch (\Exception $e) {
         $format = \Components\Citations\Models\Format::all()->where('style', 'LIKE', '%IEEE%')->row()->toObject();
     }
     //get the template keys
     $template_keys = array("type" => "{TYPE}", "cite" => "{CITE KEY}", "ref_type" => "{REF TYPE}", "date_submit" => "{DATE SUBMITTED}", "date_accept" => "{DATE ACCEPTED}", "date_publish" => "{DATE PUBLISHED}", "author" => "{AUTHORS}", "editor" => "{EDITORS}", "title" => "{TITLE/CHAPTER}", "booktitle" => "{BOOK TITLE}", "chapter" => "{CHAPTER}", "journal" => "{JOURNAL}", "journaltitle" => "{JOURNAL TITLE}", "volume" => "{VOLUME}", "number" => "{ISSUE/NUMBER}", "pages" => "{PAGES}", "isbn" => "{ISBN/ISSN}", "issn" => "{ISSN}", "doi" => "{DOI}", "series" => "{SERIES}", "edition" => "{EDITION}", "school" => "{SCHOOL}", "publisher" => "{PUBLISHER}", "institution" => "{INSTITUTION}", "address" => "{ADDRESS}", "location" => "{LOCATION}", "howpublished" => "{HOW PUBLISHED}", "url" => "{URL}", "eprint" => "{E-PRINT}", "note" => "{TEXT SNIPPET/NOTES}", "organization" => "{ORGANIZATION}", "abstract" => "{ABSTRACT}", "year" => "{YEAR}", "month" => "{MONTH}", "search_string" => "{SECONDARY LINK}", "sec_cnt" => "{SECONDARY COUNT}");
     /**
      * Values used by COINs
      *
      * @var  array
      */
     $coins_keys = array('title' => 'rft.atitle', 'journaltitle' => 'rft.jtitle', 'date_publish' => 'rft.date', 'volume' => 'rft.volume', 'number' => 'rft.issue', 'pages' => 'rft.pages', 'issn' => 'rft.issn', 'isbn' => 'rft.isbn', 'type' => 'rft.genre', 'author' => 'rft.au', 'url' => 'rft_id', 'doi' => 'rft_id=info:doi/', 'author' => 'rft.au');
     // form the formatted citation
     foreach ($template_keys as $k => $v) {
         if (!$this->keyExistsOrIsNotEmpty($k, $this) && $k != 'author') {
             $replace_values[$v] = '';
         } else {
             $replace_values[$v] = $this->{$k};
             //add to coins data if we can but not authors as that will get processed below
             if (in_array($k, array_keys($coins_keys)) && $k != 'author') {
                 //key specific
                 switch ($k) {
                     case 'title':
                         break;
                     case 'doi':
                         $coins_data[] = $this->_coins_keys[$k] . $this->{$k};
                         break;
                     case 'url':
                         $coins_data[] = $this->_coins_keys[$k] . '=' . htmlentities($this->{$k});
                         break;
                     case 'journaltitle':
                         $jt = html_entity_decode($this->{$k});
                         $jt = !preg_match('!\\S!u', $jt) ? utf8_encode($jt) : $jt;
                         $coins_data[] = $this->_coins_keys[$k] . '=' . $jt;
                         break;
                     default:
                         $coins_data[] = $this->_coins_keys[$k] . '=' . $this->{$k};
                 }
             }
             if ($k == 'author') {
                 $a = array();
                 $auth = html_entity_decode($this->{$k});
                 $auth = !preg_match('!\\S!u', $auth) ? utf8_encode($auth) : $auth;
                 // prefer the use of the relational table
                 if ($this->relatedAuthors->count() > 0) {
                     $authors = $this->relatedAuthors;
                     $authorCount = $this->relatedAuthors->count();
                 } elseif ($auth != '' && $this->relatedAuthors->count() == 0) {
                     $author_string = $auth;
                     $authors = explode(';', $author_string);
                     $authorCount = count($authors);
                 } else {
                     $authorCount = 0;
                     $replace_values[$v] = '';
                 }
                 if ($authorCount > 0) {
                     foreach ($authors as $author) {
                         // for legacy profile handling
                         if (is_string($author)) {
                             preg_match('/{{(.*?)}}/s', $author, $matches);
                             if (!empty($matches)) {
                                 $id = trim($matches[1]);
                                 if (is_numeric($id)) {
                                     $user = \User::getInstance($id);
                                     if (is_object($user)) {
                                         $a[] = '<a rel="external" href="' . \Route::url('index.php?option=com_members&id=' . $matches[1]) . '">' . str_replace($matches[0], '', $author) . '</a>';
                                     } else {
                                         $a[] = $author;
                                     }
                                 }
                             } else {
                                 $a[] = $author;
                             }
                             // add author coins
                             $coins_data[] = 'rft.au=' . trim(preg_replace('/\\{\\{\\d+\\}\\}/', '', trim($author)));
                         } elseif (is_object($author)) {
                             if ($author->uidNumber > 0) {
                                 $a[] = '<a rel="external" href="' . \Route::url('index.php?option=com_members&id=' . $author->uidNumber) . '">' . $author->author . '</a>';
                             } else {
                                 $a[] = $author->author;
                             }
                         } else {
                             $a[] = $author;
                         }
                     }
                     $replace_values[$v] = implode(", ", $a);
                 }
             }
             if ($k == 'title') {
                 $url_format = isset($config['citation_url']) ? $config['citation_url'] : 'url';
                 $custom_url = isset($config['citation_custom_url']) ? $config['citation_custom_url'] : '';
                 $url = $this->url;
                 if ($url_format == 'custom' && $custom_url != '') {
                     //parse custom url to make sure we are not using any vars
                     preg_match_all('/\\{(\\w+)\\}/', $custom_url, $matches, PREG_SET_ORDER);
                     if ($matches) {
                         foreach ($matches as $match) {
                             $field = strtolower($match[1]);
                             $replace = $match[0];
                             $replaceWith = '';
                             if (property_exists($this, $field)) {
                                 if (strstr($this->{$field}, 'http')) {
                                     $custom_url = $this->{$field};
                                 } else {
                                     $replaceWith = urlencode($this->{$field});
                                     $custom_url = str_replace($replace, $replaceWith, $custom_url);
                                 }
                             }
                         }
                         //set the citation url to be the new custom url parsed
                         $url = $custom_url;
                     }
                 }
                 //prepare url
                 if (strstr($url, "\r\n")) {
                     $url = array_filter(array_values(explode("\r\n", $url)));
                     $url = $url[0];
                 } elseif (strstr($url, " ")) {
                     $url = array_filter(array_values(explode(" ", $url)));
                     $url = $url[0];
                 }
                 $t = html_entity_decode($this->{$k});
                 $t = !preg_match('!\\S!u', $t) ? utf8_encode($t) : $t;
                 $title = $url != '' && preg_match('/http:|https:/', $url) ? '<a rel="external" class="citation-title" href="' . $url . '">' . $t . '</a>' : '<span class="citation-title">' . $t . '</span>';
                 //do we want to display single citation
                 //$singleCitationView = $config('citation_single_view', 0);
                 $singleCitationView = isset($config['citation_single_view']) ? $config['citation_single_view'] : 0;
                 if ($singleCitationView && isset($this->id)) {
                     $title = '<a href="' . \Route::url('index.php?option=com_citations&task=view&id=' . $this->id) . '">' . $t . '</a>';
                 }
                 //send back title to replace title placeholder ({TITLE})
                 $replace_values[$v] = '"' . $title . '"';
                 //add title to coin data but fixing bad chars first
                 $coins_data[] = 'rft.atitle=' . $t;
             }
             if ($k == 'pages') {
                 $replace_values[$v] = "pg: " . $this->{$k};
             }
         }
     }
     // Add more to coins
     $template = $format->format;
     $tmpl = isset($template) ? $template : $default_template;
     $cite = strtr($tmpl, $replace_values);
     // Strip empty tags
     $pattern = "/<[^\\/>]*>([\\s]?)*<\\/[^>]*>/";
     $cite = preg_replace($pattern, '', $cite);
     //reformat dates
     $pattern = "/(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})/";
     $cite = preg_replace($pattern, "\$2-\$3-\$1", $cite);
     // Reduce multiple spaces to one
     $pattern = "/\\s/s";
     $cite = preg_replace($pattern, ' ', $cite);
     // Strip empty punctuation inside
     $b = array("''" => '', '""' => '', '()' => '', '{}' => '', '[]' => '', '??' => '', '!!' => '', '..' => '.', ',,' => ',', ' ,' => '', ' .' => '', ',.' => '.', '","' => '', 'doi:.' => '', '(DOI:).' => '');
     foreach ($b as $k => $i) {
         $cite = str_replace($k, $i, $cite);
     }
     // Strip empty punctuation from the start
     $c = array("' ", '" ', '(', ') ', ', ', '. ', '? ', '! ', ': ', '; ');
     foreach ($c as $k) {
         if (substr($cite, 0, 2) == $k) {
             $cite = substr($cite, 2);
         }
     }
     // remove trailing commas
     $cite = trim($cite);
     if (substr($cite, -1) == ',') {
         $cite = substr($cite, 0, strlen($cite) - 1);
     }
     // percent encode chars
     $chars = array('%', ' ', '/', ':', '"', '\'', '&amp;');
     $replace = array("%20", "%20", "%2F", "%3A", "%22", "%27", "%26");
     $coins_data = str_replace($chars, $replace, implode('&', $coins_data));
     $cite = preg_replace('/, :/', ':', $cite);
     // highlight citation data
     // do before appendnind coins as we dont want that data accidentily highlighted (causes style issues)
     $cite = $highlight ? String::highlight($cite, $highlight) : $cite;
     // if we want coins add them
     if ($include_coins == "yes" || $coins_only == "yes") {
         $coins = '<span class="Z3988" title="' . $coins_data . '"></span>';
         if ($coins_only == "yes") {
             return $coins;
         }
         $cite .= $coins;
     }
     // output the citation
     return $cite;
 }
Example #24
0
        $overdue = $row->isOverdue();
        $oNote = $overdue ? ' <span class="block">(' . Lang::txt('PLG_PROJECTS_TODO_OVERDUE') . ')</span>' : '';
        ?>
		<tr class="pin_grey" id="todo-<?php 
        echo $row->get('id');
        ?>
">
			<td><span class="ordernum"><?php 
        echo $order;
        ?>
</span></td>
			<td><a href="<?php 
        echo Route::url($row->project()->link('todo') . '&action=view&todoid=' . $row->get('id'));
        ?>
"><?php 
        echo \Hubzero\Utility\String::truncate($row->get('content'), 200);
        ?>
</a>
				<span class="block mini faded"><?php 
        echo Lang::txt('PLG_PROJECTS_TODO_CREATED') . ' ' . $row->created('date') . ' ' . strtolower(Lang::txt('PLG_PROJECTS_TODO_BY')) . ' ' . $row->creator('name');
        ?>
					| <?php 
        echo Lang::txt('PLG_PROJECTS_TODO_COMMENTS');
        ?>
: <a href="<?php 
        echo Route::url($row->project()->link('todo') . '&action=view&todoid=' . $row->get('id'));
        ?>
"><?php 
        echo $row->comments('count');
        ?>
</a></span>
Example #25
0
 /**
  * Display a form for uploading an image and any data for current uploaded image
  *
  * @param      string  $file Image name
  * @param      integer $id   User ID
  * @return     void
  */
 public function displayTask($file = '', $id = 0)
 {
     // Do have an ID or do we need to get one?
     if (!$id) {
         $id = Request::getInt('id', 0);
     }
     $dir = String::pad($id);
     // Do we have a file or do we need to get one?
     $file = $file ? $file : Request::getVar('file', '');
     // Build the directory path
     $path = $this->path . DS . $dir;
     // Output form with error messages
     $this->view->title = $this->_title;
     $this->view->webpath = $this->config->get('uploadpath', '/site/quotes');
     $this->view->default_picture = $this->config->get('defaultpic', '/core/components/com_feedback/site/assets/img/contributor.gif');
     $this->view->path = $dir;
     $this->view->file = $file;
     $this->view->file_path = $path;
     $this->view->id = $id;
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     $this->view->setLayout('display')->display();
 }
Example #26
0
 /**
  * Get path to member dir (for provisioned projects)
  *
  * @return  string
  */
 public function getMembersPath()
 {
     // Get members config
     $mconfig = Component::params('com_members');
     // Build upload path
     $dir = \Hubzero\Utility\String::pad($this->_uid);
     $path = DS . trim($mconfig->get('webpath', '/site/members'), DS) . DS . $dir . DS . 'files';
     if (!is_dir(PATH_APP . $path)) {
         if (!Filesystem::makeDirectory(PATH_APP . $path, 0755, true, true)) {
             $this->setError(Lang::txt('UNABLE_TO_CREATE_UPLOAD_PATH'));
             return;
         }
     }
     return PATH_APP . $path;
 }
Example #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;
 }
Example #28
0
    echo $creator->picture($a->admin);
    ?>
" alt="" />
					<?php 
}
?>
					<div class="blog-content">
						<?php 
if ($showProject) {
    ?>
							<span class="project-name">
								<a href="<?php 
    echo Route::url($this->model->link());
    ?>
"><?php 
    echo \Hubzero\Utility\String::truncate($this->model->get('title'), 65);
    ?>
</a>
							</span>
						<?php 
}
?>
						<span class="actor"><?php 
echo $a->admin == 1 ? Lang::txt('COM_PROJECTS_ADMIN') : $a->name;
?>
</span>
						<span class="item-time">&middot; <?php 
echo \Components\Projects\Helpers\Html::showTime($a->recorded, true);
?>
</span>
						<?php 
Example #29
0
 /**
  * Get the content of the entry
  *
  * @param      string  $as      Format to return state in [text, number]
  * @param      integer $shorten Number of characters to shorten text to
  * @return     string
  */
 public function content($as = 'parsed', $shorten = 0)
 {
     $as = strtolower($as);
     $options = array();
     switch ($as) {
         case 'parsed':
             $content = $this->get('description.parsed', null);
             if ($content == null) {
                 $config = array('option' => 'com_jobs', 'scope' => 'job' . DS . $this->get('code'), 'pagename' => 'jobs', 'pageid' => $this->get('code'), 'filepath' => '', 'domain' => '');
                 $content = stripslashes($this->get('description'));
                 $this->importPlugin('content')->trigger('onContentPrepare', array($this->_context, &$this, &$config));
                 $this->set('description.parsed', $this->get('description'));
                 $this->set('description', $content);
                 return $this->content($as, $shorten);
             }
             $options['html'] = true;
             break;
         case 'clean':
             $content = strip_tags($this->content('parsed'));
             $content = preg_replace('/^(<!-- \\{FORMAT:.*\\} -->)/i', '', $content);
             break;
         case 'raw':
         default:
             $content = stripslashes($this->get('description'));
             $content = preg_replace('/^(<!-- \\{FORMAT:.*\\} -->)/i', '', $content);
             break;
     }
     if ($shorten) {
         $content = String::truncate($content, $shorten, $options);
     }
     return $content;
 }
Example #30
0
        $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);
        ?>
				</a>
				<span>
					<span class="<?php 
        echo $row->status == 3 ? 'rejected' : '';
        if ($row->status == 0) {
            echo $row->accepted == 1 ? 'accepted' : 'pending';
        }
        ?>
">
						<?php 
        echo $row->status == 3 ? Lang::txt('MOD_MYWISHES_REJECTED') : '';
        if ($row->status == 0) {
            echo $row->accepted == 1 ? Lang::txt('MOD_MYWISHES_ACCEPTED') : Lang::txt('MOD_MYWISHES_PENDING');
        }