Esempio n. 1
0
				<th scope="col"><?php 
echo Lang::txt('PLG_MEMBERS_MESSAGES_FROM');
?>
</th>
				<th scope="col"><?php 
echo Lang::txt('PLG_MEMBERS_MESSAGES_DATE_RECEIVED');
?>
</th>
				<th scope="col"> </th>
			</tr>
		</thead>
		<tfoot>
			<tr>
				<td colspan="6">
					<?php 
$pageNav = new \Hubzero\Pagination\Paginator($this->total, $this->filters['start'], $this->filters['limit']);
$pageNav->setAdditionalUrlParam('id', $this->member->get('id'));
$pageNav->setAdditionalUrlParam('active', 'messages');
$pageNav->setAdditionalUrlParam('task', 'archive');
$pageNav->setAdditionalUrlParam('action', '');
echo $pageNav->render();
?>
				</td>
			</tr>
		</tfoot>
		<tbody>
			<?php 
if ($this->rows) {
    ?>
				<?php 
    foreach ($this->rows as $row) {
Esempio n. 2
0
 /**
  * @param	string	The context of the content being passed to the plugin.
  * @param	object	The article object.  Note $article->text is also available
  * @param	object	The article params
  * @param	int		The 'page' number
  *
  * @return	void
  * @since	1.6
  */
 public function onContentPrepare($context, &$row, &$params, $page = 0)
 {
     $canProceed = $context == 'com_content.article';
     if (!$canProceed) {
         return;
     }
     $style = $this->params->get('style', 'pages');
     // Expression to search for.
     $regex = '#<hr(.*)class="system-pagebreak"(.*)\\/>#iU';
     $print = Request::getBool('print');
     $showall = Request::getBool('showall');
     if (!$this->params->get('enabled', 1)) {
         $print = true;
     }
     if ($print) {
         $row->text = preg_replace($regex, '<br />', $row->text);
         return true;
     }
     // Simple performance check to determine whether bot should process further.
     if (JString::strpos($row->text, 'class="system-pagebreak') === false) {
         return true;
     }
     $db = App::get('db');
     $view = Request::getString('view');
     $full = Request::getBool('fullview');
     if (!$page) {
         $page = 0;
     }
     if ($params->get('intro_only') || $params->get('popup') || $full || $view != 'article') {
         $row->text = preg_replace($regex, '', $row->text);
         return;
     }
     // Find all instances of plugin and put in $matches.
     $matches = array();
     preg_match_all($regex, $row->text, $matches, PREG_SET_ORDER);
     if ($showall && $this->params->get('showall', 1)) {
         $hasToc = $this->params->get('multipage_toc', 1);
         if ($hasToc) {
             // Display TOC.
             $page = 1;
             $this->_createToc($row, $matches, $page);
         } else {
             $row->toc = '';
         }
         $row->text = preg_replace($regex, '<br />', $row->text);
         return true;
     }
     // Split the text around the plugin.
     $text = preg_split($regex, $row->text);
     // Count the number of pages.
     $n = count($text);
     // We have found at least one plugin, therefore at least 2 pages.
     if ($n > 1) {
         $title = $this->params->get('title', 1);
         $hasToc = $this->params->get('multipage_toc', 1);
         // Adds heading or title to <site> Title.
         if ($title) {
             if ($page) {
                 $page_text = $page + 1;
                 if ($page && @$matches[$page - 1][2]) {
                     $attrs = JUtility::parseAttributes($matches[$page - 1][1]);
                     if (@$attrs['title']) {
                         $row->page_title = $attrs['title'];
                     }
                 }
             }
         }
         // Reset the text, we already hold it in the $text array.
         $row->text = '';
         if ($style == 'pages') {
             // Display TOC.
             if ($hasToc) {
                 $this->_createToc($row, $matches, $page);
             } else {
                 $row->toc = '';
             }
             // traditional mos page navigation
             $pageNav = new \Hubzero\Pagination\Paginator($n, $page, 1);
             // Page counter.
             $row->text .= '<div class="pagenavcounter">';
             $row->text .= $pageNav->getPagesCounter();
             $row->text .= '</div>';
             // Page text.
             $text[$page] = str_replace('<hr id="system-readmore" />', '', $text[$page]);
             $row->text .= $text[$page];
             // $row->text .= '<br />';
             $row->text .= '<div class="pagination">';
             // Adds navigation between pages to bottom of text.
             if ($hasToc) {
                 $this->_createNavigation($row, $page, $n);
             }
             // Page links shown at bottom of page if TOC disabled.
             if (!$hasToc) {
                 $row->text .= $pageNav->getPagesLinks();
             }
             $row->text .= '</div>';
         } else {
             $t[] = $text[0];
             $t[] = (string) Html::$style('start');
             foreach ($text as $key => $subtext) {
                 if ($key >= 1) {
                     $match = $matches[$key - 1];
                     $match = (array) JUtility::parseAttributes($match[0]);
                     if (isset($match['alt'])) {
                         $title = stripslashes($match["alt"]);
                     } elseif (isset($match['title'])) {
                         $title = stripslashes($match['title']);
                     } else {
                         $title = Lang::txt('PLG_CONTENT_PAGEBREAK_PAGE_NUM', $key + 1);
                     }
                     $t[] = (string) Html::$style('panel', $title, 'basic-details');
                 }
                 $t[] = (string) $subtext;
             }
             $t[] = (string) Html::$style('end');
             $row->text = implode(' ', $t);
         }
     }
     return true;
 }
Esempio n. 3
0
 /**
  * Show sent messages
  *
  * @param      object  $database JDatabase
  * @param      string  $option   Name of the component
  * @param      object  $member   Current member
  * @return     string
  */
 public function sent($database, $option, $member)
 {
     $view = $this->view('sent', 'default');
     $view->option = $option;
     $view->member = $member;
     // Filters for returning results
     $filters = array();
     $filters['limit'] = Request::getState($option . '.plugin.messages.limit', 'limit', Config::get('list_limit'), 'int');
     $filters['start'] = Request::getState($option . '.plugin.messages.limitstart', 'limitstart', 0, 'int');
     $filters['created_by'] = $member->get('uidNumber');
     $recipient = new \Hubzero\Message\Message($database);
     $view->total = $recipient->getSentMessagesCount($filters);
     $view->rows = $recipient->getSentMessages($filters);
     $pageNav = new \Hubzero\Pagination\Paginator($view->total, $filters['start'], $filters['limit']);
     $pageNav->setAdditionalUrlParam('id', $member->get('uidNumber'));
     $pageNav->setAdditionalUrlParam('active', 'messages');
     $pageNav->setAdditionalUrlParam('task', 'sent');
     $pageNav->setAdditionalUrlParam('action', '');
     $view->pagenavhtml = $pageNav->render();
     foreach ($this->getErrors() as $error) {
         $view->setError($error);
     }
     return $view->loadTemplate();
 }
Esempio n. 4
0
			</thead>
			<tbody>
	<?php 
    foreach ($this->rows as $row) {
        if ($row->isPublished()) {
            $showStats = true;
        }
        $this->view('_row')->set('project', $this->project)->set('pub', $this->pub)->set('row', $row)->set('i', $i)->display();
        $i++;
    }
    ?>
			</tbody>
		</table>
		<?php 
    // Pagination
    $pageNav = new \Hubzero\Pagination\Paginator($this->total, $this->filters['start'], $this->filters['limit']);
    $pageNav->setAdditionalUrlParam('sortby', $this->filters['sortby']);
    $pageNav->setAdditionalUrlParam('sortdir', $this->filters['sortdir']);
    $pagenavhtml = $pageNav->render();
    ?>
		<fieldset>
			<?php 
    echo $pagenavhtml;
    ?>
		</fieldset>
		</form>
	</div>
	<?php 
} else {
    echo '<p class="noresults">' . Lang::txt('PLG_PROJECTS_PUBLICATIONS_NO_PUBS_FOUND') . ' <span class="addnew"><a href="' . Route::url($this->project->link('publications') . '&action=start') . '"  >' . Lang::txt('PLG_PROJECTS_PUBLICATIONS_START_PUBLICATION') . '</a></span></p>';
    // Show intro banner with publication steps
Esempio n. 5
0
    echo Lang::txt('PLG_PROJECTS_PUBLICATIONS_MY_PUBLICATIONS');
    ?>
</h3>
			<?php 
    if (!empty($mypubs)) {
        ?>
			<ul class="mypubs">
				<?php 
        foreach ($mypubs as $row) {
            $this->view('_item')->set('row', $row)->set('project', $this->project)->set('pub', $this->pub)->display();
        }
        ?>
			</ul>
			<?php 
        // Pagination
        $pageNav = new \Hubzero\Pagination\Paginator($total, $filters['start'], $filters['limit']);
        echo $pageNav->render();
        ?>
			</form>
			<?php 
    } else {
        ?>
				<p class="noresults"><?php 
        echo Lang::txt('PLG_PROJECTS_PUBLICATIONS_NO_RELEVANT_PUBS_FOUND');
        ?>
</p>
			<?php 
    }
    ?>
		<?php 
}
Esempio n. 6
0
 /**
  * documentByTypeTask - view a type's records
  * 
  * @access public
  * @return void
  */
 public function documentByTypeTask()
 {
     $type = Request::getVar('type', '');
     $filter = Request::getVar('filter', '');
     $limitstart = Request::getInt('limitstart', 0);
     $limit = Request::getInt('limit', 10);
     // Display CMS errors
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     // Get the blacklist to indidicate marked for removal
     $blacklistEntries = Blacklist::all()->select('doc_id')->where('doc_id', 'LIKE', $type . '%')->rows()->toObject();
     // @TODO: PHP 5.5+ supports array_column()
     $blacklist = array();
     foreach ($blacklistEntries as $entry) {
         array_push($blacklist, $entry->doc_id);
     }
     // Temporary override to get all matching documents
     if ($filter == '') {
         $filter = '*:*';
     }
     // Instantitate and get all results for a particular document type
     try {
         $config = Component::params('com_search');
         $query = new \Hubzero\Search\Query($config);
         $results = $query->query($filter)->addFilter('hubtype', array('hubtype', '=', $type))->limit($limit)->start($limitstart)->run()->getResults();
         // Get the total number of records
         $total = $query->getNumFound();
     } catch (\Solarium\Exception\HttpException $e) {
         App::redirect(Route::url('index.php?option=com_search&task=display', false));
     }
     // Pass the type the view
     $this->view->type = $type;
     // Create the pagination
     $pagination = new \Hubzero\Pagination\Paginator($total, $limitstart, $limit);
     $pagination->setLimits(array('5', '10', '15', '20', '50', '100', '200'));
     $this->view->pagination = $pagination;
     // Pass the filters and documents to the display
     $this->view->filter = !isset($filter) || ($filter = '*:*' ? '' : $filter);
     $this->view->documents = isset($results) ? $results : array();
     $this->view->blacklist = $blacklist;
     // Display the view
     $this->view->display();
 }