示例#1
0
 /**
  * Show the results of the import
  *
  * @return  void
  */
 private function savedAction()
 {
     // Check if they're logged in
     if (User::isGuest()) {
         return $this->loginAction();
     }
     if (!$this->params->get('access-manage')) {
         throw new Exception(Lang::txt('PLG_MEMBERS_CITATIONS_NOT_AUTHORIZED'), 403);
     }
     // Get the session object
     $session = App::get('session');
     // Get the citations
     $citations_saved = $session->get('citations_saved');
     $citations_not_saved = $session->get('citations_not_saved');
     $citations_error = $session->get('citations_error');
     // Check to make sure we have citations
     if (!$citations_saved && !$citations_not_saved) {
         App::redirect(Route::url($this->member->getLink() . '&active=' . $this->_name . '&action=import'), Lang::txt('PLG_MEMBERS_CITATIONS_IMPORT_MISSING_FILE_CONTINUE'), 'error');
         return;
     }
     $view = $this->view('saved', 'import');
     $view->member = $this->member;
     $view->option = $this->option;
     $view->isAdmin = $this->params->get('access-manage');
     $view->config = Component::params('com_citations');
     $view->database = $this->database;
     $view->filters = array('start' => 0, 'search' => '');
     $view->citations = array();
     foreach ($citations_saved as $cs) {
         $cc = new \Components\Citations\Tables\Citation($this->database);
         $cc->load($cs);
         $view->citations[] = $cc;
     }
     $view->openurl['link'] = '';
     $view->openurl['text'] = '';
     $view->openurl['icon'] = '';
     //take care fo type
     $ct = new \Components\Citations\Tables\Type($this->database);
     $view->types = $ct->getType();
     $view->messages = Notify::messages('plg_members_citations');
     return $view->loadTemplate();
 }
示例#2
0
    echo Lang::txt('PLG_GROUPS_CITATIONS_IMPORT_REQUIRE_ATTENTION', count($citations_require_attention));
    ?>
</th>
						</tr>
					</thead>
					<tbody>
						<?php 
    $counter = 0;
    ?>
						<?php 
    foreach ($citations_require_attention as $c) {
        ?>
							<?php 
        //load the duplicate citation
        $cc = new \Components\Citations\Tables\Citation($database);
        $cc->load($c['duplicate']);
        //get the type
        $ct = new \Components\Citations\Tables\Type($database);
        $type = $ct->getType($cc->type);
        $type_title = $type[0]['type_title'];
        //get citations tags
        $th = new \Components\Citations\Tables\Tags($cc->id);
        $tags = $th->render('string');
        $badges = $th->render('string', array('label' => 'badges'), true);
        ?>
							<tr>
								<!--<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>-->
								<td>
									<span class="citation-title"><u><?php 
        echo Lang::txt('PLG_GROUPS_CITATIONS_IMPORT_DUPLICATE');
        ?>
示例#3
0
 /**
  * Static method for formatting results
  *
  * @param      object $row Database row
  * @return     string HTML
  */
 public static function out($row)
 {
     $row->author = isset($row->alias) ? $row->alias : '';
     $row->booktitle = isset($row->itext) ? $row->itext : '';
     $row->doi = isset($row->ftext) ? $row->ftext : '';
     $row->published = isset($row->state) ? $row->state : '';
     $row->year = isset($row->created_by) ? $row->created_by : '';
     $row->month = isset($row->modified) ? $row->modified : '';
     $row->isbn = isset($row->publish_up) ? $row->publish_up : '';
     $row->journal = isset($row->publish_down) ? $row->publish_down : '';
     $row->url = isset($row->href) ? $row->href : '';
     $row->volume = isset($row->params) ? $row->params : '';
     $row->number = isset($row->rcount) ? $row->rcount : '';
     $row->type = isset($row->data1) ? $row->data1 : '';
     $row->pages = isset($row->data2) ? $row->data2 : '';
     $row->publisher = isset($row->data3) ? $row->data3 : '';
     require_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'tables' . DS . 'type.php';
     require_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'tables' . DS . 'association.php';
     require_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'tables' . DS . 'format.php';
     require_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'helpers' . DS . 'format.php';
     $config = \Component::params('com_citations');
     switch ($config->get("citation_label", "number")) {
         case 'none':
             $citations_label_class = 'no-label';
             break;
         case 'number':
             $citations_label_class = 'number-label';
             break;
         case 'type':
             $citations_label_class = 'type-label';
             break;
         case 'both':
             $citations_label_class = 'both-label';
             break;
     }
     $database = \App::get('db');
     $citationsFormat = new \Components\Citations\Tables\Format($database);
     $template = $citationsFormat->getDefaultFormat() ? $citationsFormat->getDefaultFormat()->format : null;
     $formatter = new \Components\Citations\Helpers\Format();
     $formatter->setTemplate($template);
     // Start building the HTML
     $html = "\t" . '<li class="citation-entry">' . "\n";
     $html .= "\t\t" . '<p class="title">';
     //are we trying wanting to direct to single citaiton view
     $citationSingleView = $config->get('citation_single_view', 1);
     if ($citationSingleView) {
         $html .= '<a href="' . \Route::url('index.php?option=com_citations&task=view&id=' . $row->id) . '">';
     } else {
         $html .= '<a href="' . \Route::url('index.php?option=com_citations&task=browse&type=' . $row->type . '&year=' . $row->year . '&search=' . \Hubzero\Utility\String::truncate(\Hubzero\Utility\Sanitize::stripAll(stripslashes($row->title)), 50)) . '">';
     }
     $html .= \Hubzero\Utility\String::truncate(\Hubzero\Utility\Sanitize::stripAll(stripslashes($row->title)), 200);
     $html .= '</a></p>' . "\n";
     $html .= '<p class="details ' . $citations_label_class . '">' . \Lang::txt('PLG_TAGS_CITATION');
     if ($config->get('citation_label', 'number') != 'none') {
         $types = self::getTypes();
         $type = '';
         foreach ($types as $t) {
             if ($t['id'] == $row->type) {
                 $type = $t['type_title'];
             }
         }
         $type = $type != '' ? $type : 'Generic';
         $html .= ' <span>|</span> ' . $type;
     }
     $html .= '</p>';
     require_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'tables' . DS . 'citation.php';
     $db = \App::get('db');
     $cc = new \Components\Citations\Tables\Citation($db);
     $cc->load($row->id);
     $html .= '<p>' . $formatter->formatCitation($cc, null, $config->get("citation_coins", 1), $config) . '</p>';
     $html .= "\t" . '</li>' . "\n";
     // Return output
     return $html;
 }