Example #1
0
 /**
  * Prepares the row for output
  *
  * @param string $mode	The mode for preparing data. 'site' for fron-end data, 'admin' for administrator operations.
  *
  * @return void
  */
 public function prepare($mode = null)
 {
     // Prepare generic properties like dates and authors
     parent::prepare($mode);
     // Edit link
     $this->editLink = JURI::base(true) . '/index.php?option=com_k2#categories/edit/' . $this->id;
     // Add link
     $this->addLink = JURI::base(true) . '/index.php?option=com_k2#items/add';
     // Permisisons
     $user = JFactory::getUser();
     if ($user->guest) {
         $this->canEdit = false;
         $this->canEditState = false;
         $this->canDelete = false;
         $this->canSort = false;
         $this->canAddItem = false;
     } else {
         $this->canEdit = $user->authorise('k2.category.edit', 'com_k2.category.' . $this->id) || $user->id == $this->created_by && $user->authorise('k2.category.edit.own', 'com_k2.category.' . $this->id);
         $this->canEditState = $user->authorise('k2.category.edit.state', 'com_k2.category.' . $this->id);
         $this->canDelete = $user->authorise('k2.category.delete', 'com_k2.category.' . $this->id);
         $this->canSort = $user->authorise('k2.category.edit', 'com_k2');
         $this->canAddItem = $user->authorise('k2.item.create', 'com_k2.category.' . $this->id);
     }
     // Image
     $this->image = $this->getImage();
 }
Example #2
0
 /**
  * Prepares the row for output
  *
  * @param string $mode	The mode for preparing data. 'site' for fron-end data, 'admin' for administrator operations.
  *
  * @return void
  */
 public function prepare($mode = null)
 {
     // Prepare generic properties like dates and authors
     parent::prepare($mode);
     // Prepare specific properties
     $this->editLink = JURI::base(true) . '/index.php?option=com_k2#usergroups/edit/' . $this->id;
 }
Example #3
0
 /**
  * Prepares the row for output
  *
  * @param string $mode	The mode for preparing data. 'site' for fron-end data, 'admin' for administrator operations.
  *
  * @return void
  */
 public function prepare($mode = null)
 {
     // Prepare generic properties like dates and authors
     parent::prepare($mode);
     // Prepare specific properties
     $this->editLink = JURI::base(true) . '/index.php?option=com_k2#extrafields/edit/' . $this->id;
     // Set type label
     $this->typeName = JText::_('K2_EXTRA_FIELD_TYPE_' . strtoupper($this->type));
 }
 /**
  * Prepares the row for output
  *
  * @param string $mode	The mode for preparing data. 'site' for fron-end data, 'admin' for administrator operations.
  *
  * @return void
  */
 public function prepare($mode = null)
 {
     // Prepare generic properties like dates and authors
     parent::prepare($mode);
     // Prepare specific properties
     $this->editLink = JURI::base(true) . '/index.php?option=com_k2#extrafieldsgroups/edit/' . $this->id;
     // Get group fields
     $this->fields = $this->getFields();
 }
Example #5
0
 /**
  * Prepares the row for output
  *
  * @param string $mode	The mode for preparing data. 'site' for front-end data, 'admin' for administrator operations.
  *
  * @return void
  */
 public function prepare($mode = null)
 {
     // Prepare generic properties like dates and authors
     parent::prepare($mode);
     // Category
     $this->category = $this->getCategory();
     // Edit link
     $this->editLink = JURI::base(true) . '/index.php?option=com_k2#items/edit/' . $this->id;
     // Permisisons
     $user = JFactory::getUser();
     if ($user->guest) {
         $this->canEdit = false;
         $this->canEditState = false;
         $this->canEditFeaturedState = false;
         $this->canDelete = false;
         $this->canSort = false;
     } else {
         $this->canEdit = $user->authorise('k2.item.edit', 'com_k2.item.' . $this->id) || $user->id == $this->created_by && $user->authorise('k2.item.edit.own', 'com_k2.item.' . $this->id);
         $this->canEditState = $user->authorise('k2.item.edit.state', 'com_k2.item.' . $this->id);
         $this->canEditFeaturedState = $user->authorise('k2.item.edit.state.featured', 'com_k2.item.' . $this->id);
         $this->canDelete = $user->authorise('k2.item.delete', 'com_k2.item.' . $this->id);
         $this->canSort = $user->authorise('k2.item.edit', 'com_k2');
     }
     // Hits
     $this->hits = (int) $this->hits;
     // Start and end dates
     if ((int) $this->start_date > 0) {
         $this->startDate = JHtml::_('date', $this->start_date, 'Y-m-d');
         $this->startTime = JHtml::_('date', $this->start_date, 'H:i');
     }
     if ((int) $this->end_date > 0) {
         $this->endDate = JHtml::_('date', $this->end_date, 'Y-m-d');
         $this->endTime = JHtml::_('date', $this->end_date, 'H:i');
     }
     // Images
     $this->images = $this->getImages();
     $this->image = $this->getImage();
     // Author
     $this->author = $this->getAuthor();
     // Unset some properties to allow lazy loading
     $this->_attachments = $this->attachments;
     unset($this->attachments);
     $this->_tags = $this->tags;
     unset($this->tags);
     $this->_media = $this->media;
     unset($this->media);
     $this->_galleries = $this->galleries;
     unset($this->galleries);
 }
Example #6
0
 /**
  * Prepares the row for output
  *
  * @param string $mode	The mode for preparing data. 'site' for fron-end data, 'admin' for administrator operations.
  *
  * @return void
  */
 public function prepare($mode = null)
 {
     // Prepare generic properties like dates and authors
     parent::prepare($mode);
     if ($this->id) {
         // Prepare specific properties
         $this->editLink = JURI::base(true) . '/index.php?option=com_k2#users/edit/' . $this->id;
         $this->enabled = (int) (!$this->block);
         $this->activated = (int) (!$this->activation);
         $this->groupsValue = isset($this->groups) ? implode(', ', $this->groups) : '';
         $this->canAdd = JFactory::getUser($this->id)->authorise('k2.item.create', 'com_k2');
         $this->addLink = JURI::base(true) . '/index.php?option=com_k2#items/add';
         // Image
         $this->image = $this->getImage();
         // Unset password
         $this->password = '';
     }
 }
Example #7
0
 /**
  * Prepares the row for output
  *
  * @param string $mode	The mode for preparing data. 'site' for fron-end data, 'admin' for administrator operations.
  *
  * @return void
  */
 public function prepare($mode = null)
 {
     // Prepare generic properties like dates and authors
     parent::prepare($mode);
     // Prepare specific properties
     $this->editLink = JURI::base(true) . '/index.php?option=com_k2#comments/edit/' . $this->id;
     // Created date
     $this->createdOn = JHtml::_('date', $this->date, JText::_('K2_DATE_FORMAT'));
     // Get application
     $application = JFactory::getApplication();
     // Front-end only
     if ($application->isSite()) {
         // Get user
         $this->user = $this->getUser();
         // Edit permission
         $this->canEdit = K2Comments::getPermissions()->canEdit;
         // Report permission
         $user = JFactory::getUser();
         $this->canReport = K2Comments::getPermissions()->canReport && $user->id != $this->userId;
         // Report user permission
         $this->canReportUser = K2Comments::getPermissions()->canReportUser && $this->userId > 0 && $user->id != $this->userId;
         // Apply no-follow to all links
         $document = new DOMDocument();
         $document->loadHTML('<?xml encoding="UTF-8"><html><body>' . $this->text . '</body></html>');
         $links = $document->getElementsByTagName('a');
         foreach ($links as $link) {
             $link->setAttribute('rel', 'nofollow');
         }
         $this->text = $document->saveHTML($document->getElementsByTagName('body')->item(0));
         $this->text = str_replace(array('<body>', '</body>'), '', $this->text);
         // Item link
         $this->itemLink = $this->getItemLink();
         // Category link
         $this->categoryLink = $this->getCategoryLink();
         // Is Author response?
         $this->isAuthorResponse = $this->getIsAuthorResponse();
         // Unset sensitive data if user is not authorised to edit the comment
         if (!$this->canEdit) {
             unset($this->email);
             unset($this->ip);
             unset($this->hostname);
         }
     }
 }
Example #8
0
 /**
  * Prepares the row for output
  *
  * @param string $mode	The mode for preparing data. 'site' for fron-end data, 'admin' for administrator operations.
  *
  * @return void
  */
 public function prepare($mode = null)
 {
     // Prepare generic properties like dates and authors
     parent::prepare($mode);
 }
Example #9
0
 /**
  * Prepares the row for output
  *
  * @param string $mode	The mode for preparing data. 'site' for fron-end data, 'admin' for administrator operations.
  *
  * @return void
  */
 public function prepare($mode = null)
 {
     // Prepare generic properties like dates and authors
     parent::prepare($mode);
     $this->user = JFactory::getUser($this->userId)->name;
 }