Exemplo n.º 1
0
 /**
  * Method to get an object containing all of the table columns and values.
  *
  * @param   JTableInterface  $table  JTable object.
  *
  * @return  stdClass  Contains all of the columns and values.
  *
  * @since   3.2
  */
 public function getDataObject(JTableInterface $table)
 {
     $fields = $table->getFields();
     $dataObject = new stdClass();
     foreach ($fields as $field) {
         $fieldName = $field->Field;
         $dataObject->{$fieldName} = $table->get($fieldName);
     }
     return $dataObject;
 }
Exemplo n.º 2
0
 /**
  * Constructor: Associates to $table $this observer
  *
  * @param   JTableInterface  $table  Table to be observed
  *
  * @since   3.1.2
  */
 public function __construct(JTableInterface $table)
 {
     $table->attachObserver($this);
     $this->table = $table;
 }
Exemplo n.º 3
0
 /**
  * Method to untag an item
  *
  * @param   integer          $contentId  ID of the content item being untagged
  * @param   JTableInterface  $table      JTable object being untagged
  * @param   array            $tags       Array of tags to be untagged. Use an empty array to untag all existing tags.
  *
  * @return  boolean  true on success, otherwise false.
  *
  * @since   3.1
  */
 public function unTagItem($contentId, JTableInterface $table, $tags = array())
 {
     $key = $table->getKeyName();
     $id = $table->{$key};
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->delete('#__contentitem_tag_map')->where($db->quoteName('type_alias') . ' = ' . $db->quote($this->typeAlias))->where($db->quoteName('content_item_id') . ' = ' . (int) $id);
     if (is_array($tags) && count($tags) > 0) {
         JArrayHelper::toInteger($tags);
         $query->where($db->quoteName('tag_id') . ' IN ' . implode(',', $tags));
     }
     $db->setQuery($query);
     return (bool) $db->execute();
 }