Exemple #1
0
 /**
  * Get the rendering of this field type for a repeatable (grid) display,
  * e.g. in a view listing many item (typically a "browse" task)
  *
  * @since 2.0
  *
  * @return  string  The field HTML
  */
 public function getRepeatable()
 {
     // Initialise
     $slug_format = '(%s)';
     $slug_class = 'small';
     // Get field parameters
     if ($this->element['slug_field']) {
         $slug_field = (string) $this->element['slug_field'];
     } else {
         $slug_field = $this->item->getColumnAlias('slug');
     }
     if ($this->element['slug_format']) {
         $slug_format = (string) $this->element['slug_format'];
     }
     if ($this->element['slug_class']) {
         $slug_class = (string) $this->element['slug_class'];
     }
     // Get the regular display
     $html = parent::getRepeatable();
     $slug = $this->item->{$slug_field};
     $html .= '<br />' . '<span class="' . $slug_class . '">';
     $html .= JText::sprintf($slug_format, $slug);
     $html .= '</span>';
     return $html;
 }
Exemple #2
0
 /**
  * Get the rendering of this field type for a repeatable (grid) display,
  * e.g. in a view listing many item (typically a "browse" task).
  * We're going to check if the current user can edit an item or not, creating the correct link
  *
  * @since 2.0
  *
  * @return  string  The field HTML
  */
 public function getRepeatable()
 {
     $userid = JFactory::getUser()->id;
     $itemid = $this->item->todo_item_id;
     $created_by = $this->item->created_by;
     // If I can edit, or I am editing a record of mine (and I can do it) or I have
     // special permissions on that record, display the edit link
     if (JAccess::check($userid, 'core.edit', 'com_todo') || $created_by == $userid && JAccess::check($userid, 'core.edit.own', 'com_todo') || $created_by == $userid && JAccess::check($userid, 'core.edit.own', 'com_todo.item.' . $itemid) || JAccess::check($userid, 'core.edit', 'com_todo.item.' . $itemid)) {
         $url = 'index.php?option=com_todo&view=item&task=edit&id=[ITEM:ID]';
     } else {
         $url = 'index.php?option=com_todo&view=item&id=[ITEM:ID]';
     }
     $this->element['url'] = $url;
     return parent::getRepeatable();
 }
 /**
  * Method to get certain otherwise inaccessible properties from the form field object.
  *
  * @param   string  $name  The property name for which to the the value.
  *
  * @return  mixed  The property value or null.
  *
  * @since   2.0
  */
 public function __get($name)
 {
     switch ($name) {
         case 'static':
             if (empty($this->static)) {
                 $this->static = $this->getStatic();
             }
             return $this->static;
             break;
         case 'repeatable':
             if (empty($this->repeatable)) {
                 $this->repeatable = $this->getRepeatable();
             }
             return $this->repeatable;
             break;
         default:
             return parent::__get($name);
     }
 }
 /**
  * Get the rendering of this field type for a repeatable (grid) display,
  * e.g. in a view listing many item (typically a "browse" task)
  *
  * @since 2.0
  *
  * @return  string  The field HTML
  */
 public function getRepeatable()
 {
     $this->value = $this->formatInvTempLevels($this->value);
     return parent::getRepeatable();
 }