/** * Check completion status * * @return object */ public function getStatus($pub = NULL, $manifest = NULL, $elementId = NULL) { // Set block manifest if ($this->_manifest === NULL) { $this->_manifest = $manifest ? $manifest : self::getManifest(); } // Start status $status = new \Components\Publications\Models\Status(); // Get authors if (!isset($pub->_authors)) { $pAuthors = new \Components\Publications\Tables\Author($this->_parent->_db); $pub->_authors = $pAuthors->getAuthors($pub->version_id); $pub->_submitter = $pAuthors->getSubmitter($pub->version_id, $pub->created_by); } // Are authors required? $required = $this->_manifest->params->required; $status->status = $required && (!$pub->_authors || count($pub->_authors) == 0) ? 0 : 1; if ($status->status == 0) { $status->setError('Missing authors'); } return $status; }
/** * Static method for formatting results * * @param object $row Database row * @return string HTML */ public static function out($row) { $database = App::get('db'); $thedate = Date::of($row->published_up)->toLocal('d M Y'); // Get version authors $pa = new \Components\Publications\Tables\Author($database); $authors = $pa->getAuthors($row->version_id); $html = "\t" . '<li class="resource">' . "\n"; $html .= "\t\t" . '<p class="title"><a href="' . $row->href . '">' . stripslashes($row->title) . '</a></p>' . "\n"; $html .= "\t\t" . '<p class="details">' . $thedate . ' <span>|</span> ' . stripslashes($row->cat_name); if ($authors) { $html .= ' <span>|</span>' . Lang::txt('PLG_MEMBERS_IMPACT_CONTRIBUTORS') . ': ' . \Components\Publications\Helpers\Html::showContributors($authors, false, true) . "\n"; } if ($row->doi) { $html .= ' <span>|</span> doi:' . $row->doi . "\n"; } if (!$row->project_provisioned && (isset($row->project_private) && $row->project_private != 1 || $row->author == true)) { $url = 'index.php?option=com_projects&alias=' . $row->project_alias; $url .= $row->author == true ? '&active=publications&pid=' . $row->id : ''; $html .= ' <span>|</span> Project: '; $html .= '<a href="'; $html .= Route::url($url) . '">'; $html .= $row->project_title; $html .= '</a>'; $html .= "\n"; } $html .= '</p>' . "\n"; if ($row->text) { $html .= "\t\t<p>" . \Hubzero\Utility\String::truncate(strip_tags(stripslashes($row->text)), 300) . "</p>\n"; } $html .= "\t" . '</li>' . "\n"; return $html; }
* * 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>
case 'date_modified': $show_date = 2; break; case 'date': default: $show_date = 3; break; } // Get version authors $pa = new \Components\Publications\Tables\Author($database); ?> <ol class="results" id="publications"> <?php foreach ($this->results as $line) { $authors = $pa->getAuthors($line->version_id); // Get parameters $params = clone $this->config; $rparams = new \Hubzero\Config\Registry($line->params); $params->merge($rparams); // Set the display date switch ($show_date) { case 0: $thedate = ''; break; case 1: $thedate = $line->created(); break; case 2: $thedate = $line->modified(); break;
/** * Static method for formatting results * * @param object $row Database row * @return string HTML */ public static function out($row) { include_once Component::path('com_publications') . DS . 'tables' . DS . 'author.php'; require_once Component::path('com_publications') . DS . 'helpers' . DS . 'html.php'; $row->href = Route::url('index.php?option=com_publications&id=' . $row->id); $database = App::get('db'); // Get version authors $pa = new \Components\Publications\Tables\Author($database); $authors = $pa->getAuthors($row->ftext); // Get the component params $config = Component::params('com_publications'); $row->rating = $row->rcount; $row->category = $row->data1; $row->area = $row->data2; $row->ranking = $row->data3; // Set the display date switch ($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; } if (strstr($row->href, 'index.php')) { $row->href = Route::url($row->href); } // Start building the HTML $html = "\t" . '<li class="'; $html .= 'publication">' . "\n"; $html .= "\t\t" . '<p class="title"><a href="' . $row->href . '/?v=' . $row->alias . '">' . stripslashes($row->title) . '</a></p>' . "\n"; $html .= "\t\t" . '<p class="details">' . $thedate . ' <span>|</span> ' . $row->area; if ($authors) { $html .= ' <span>|</span> ' . Lang::txt('PLG_TAGS_PUBLICATIONS_CONTRIBUTORS') . ' ' . stripslashes(\Components\Publications\Helpers\Html::showContributors($authors, true, false)); } $html .= '</p>' . "\n"; if ($row->itext) { $html .= "\t\t" . '<p>' . \Hubzero\Utility\String::truncate(\Hubzero\Utility\Sanitize::stripAll(stripslashes($row->itext)), 200) . '</p>' . "\n"; } $html .= "\t\t" . '<p class="href">' . Request::base() . trim($row->href . '/?v=' . $row->alias, '/') . '</p>' . "\n"; $html .= "\t" . '</li>' . "\n"; // Return output return $html; }
/** * 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'); $config = Component::params('com_publications'); // Get version authors $pa = new \Components\Publications\Tables\Author($database); $authors = $pa->getAuthors($row->version_id); // Start building HTML $html = "\t" . '<li class="publication">' . "\n"; $html .= "\t\t" . '<p><span class="pub-thumb"><img src="' . Route::url('index.php?option=com_publications&id=' . $row->id . '&v=' . $row->version_id) . '/Image:thumb' . '" alt="" /></span>'; $html .= '<span class="pub-details"><a href="' . $row->href . '">' . stripslashes($row->title) . '</a>' . "\n"; $html .= "\t\t" . '<span class="block details">' . Date::of($row->published_up)->toLocal('d M Y') . ' <span>|</span> ' . $row->cat_name; if ($authors) { $html .= ' <span>|</span> ' . Lang::txt('PLG_WHATSNEW_PUBLICATIONS_CONTRIBUTORS') . ' ' . \Components\Publications\Helpers\Html::showContributors($authors, false, true); } $html .= '</span></span></p>' . "\n"; if ($row->text) { $html .= "\t\t" . '<p>' . \Hubzero\Utility\String::truncate(\Hubzero\Utility\Sanitize::stripAll(stripslashes($row->text)), 200) . '</p>' . "\n"; } $html .= "\t\t" . '<p class="href">' . Request::base() . trim($row->href, '/') . '</p>' . "\n"; $html .= "\t" . '</li>' . "\n"; // Return output return $html; }
/** * Display publications user authors * * @apiMethod GET * @apiUri /publications/list * @apiParameter { * "name": "limit", * "description": "Number of result to return.", * "type": "integer", * "required": false, * "default": 0 * } * @apiParameter { * "name": "start", * "description": "Number of where to start returning results.", * "type": "integer", * "required": false, * "default": 0 * } * @apiParameter { * "name": "sort", * "description": "Field to sort results by.", * "type": "string", * "required": false, * "default": "title", * "allowedValues": "title, created, alias" * } * @apiParameter { * "name": "sort_Dir", * "description": "Direction to sort results by.", * "type": "string", * "required": false, * "default": "desc", * "allowedValues": "asc, desc" * } * @return void */ public function listTask() { $model = new Publication(); Lang::load('plg_projects_publications', PATH_CORE . DS . 'plugins' . DS . 'projects' . DS . 'publications'); // Set filters $filters = array('limit' => Request::getInt('limit', Config::get('list_limit')), 'start' => Request::getInt('start', 0), 'sortby' => Request::getWord('sort', 'title'), 'sortdir' => strtoupper(Request::getWord('sort_Dir', 'ASC')), 'author' => User::get('id')); $response = new stdClass(); $response->publications = array(); $response->total = $model->entries('count', $filters); $database = \App::get('db'); $pa = new \Components\Publications\Tables\Author($database); if ($response->total) { $base = rtrim(Request::base(), '/'); foreach ($model->entries('list', $filters) as $i => $entry) { $obj = new stdClass(); $obj->id = $entry->get('id'); $obj->alias = $entry->get('alias'); $obj->title = $entry->get('title'); $obj->abstract = $entry->get('abstract'); $obj->creator = $entry->creator('name'); $obj->created = $entry->get('created'); $obj->published = $entry->published('date'); $obj->masterType = $entry->masterType()->type; $obj->category = $entry->category()->name; $obj->version = $entry->get('version_number'); $obj->versionLabel = $entry->get('version_label'); $obj->status = $entry->get('state'); $obj->statusName = $entry->getStatusName(); $obj->authors = $pa->getAuthors($entry->get('version_id')); $obj->thumbUrl = str_replace('/api', '', $base . '/' . ltrim(Route::url($entry->link('thumb')), '/')); $obj->uri = str_replace('/api', '', $base . '/' . ltrim(Route::url($entry->link('version')), '/')); $obj->manageUri = str_replace('/api', '', $base . '/' . ltrim(Route::url($entry->link('editversion')), '/')); $obj->project = $entry->project()->get('alias'); $response->publications[] = $obj; } } $this->send($response); }
<input id="pub-search" name="search" placeholder="Start typing here" type="text" data-list=".pub-selector" autocomplete="off" /> <ul class="pub-selector" id="pub-selector"> <?php foreach ($results as $item) { $selected = false; $liId = 'choice-' . $item->get('id'); /*$info = $item->info; if ($item->url) { $info .= ' <a href="' . $item->url . '" target="_blank">' . Lang::txt('Read license terms ›') . '</a>'; } $icon = $item->icon; $icon = str_replace('/components/com_publications/assets/img/', '/core/components/com_publications/site/assets/img/', $icon); */ $authors = $pa->getAuthors($item->get('version_id')); $description = ''; if ($item->get('abstract')) { $description = \Hubzero\Utility\String::truncate(stripslashes($item->get('abstract')), 300) . "\n"; } else { if ($item->get('description')) { $description = \Hubzero\Utility\String::truncate(stripslashes($item->get('description')), 300) . "\n"; } } $info = array(); if ($item->get('category')) { $info[] = $item->get('cat_name'); } if ($item->get('doi')) { $info[] = 'doi:' . $item->get('doi'); }