src/libraries/adapters/DatabaseMySql.php
/**
    * Insert groups into the mapping table
    *
    * @param string $id Element id (id of the photo or video)
    * @param string $groups Groups to be added
    * @param string $type Element type (photo or video)
    * @return boolean
    */
Insert groups into the mapping table
@param string $id Element id (id of the photo or video)
@param string $groups Groups to be added
@param string $type Element type (photo or video)
@return boolean
Insert groups into the mapping table @param string $id Element id ( id of the photo or video ) @param string $groups Groups to be added @param string $type Element type ( photo or video ) @return boolean
private function addGroupsToElement($id, $groups, $type)
  {
    if(empty($id) || empty($groups) || empty($type))
      return false;
    $hasGroup = false;
    $sql = "REPLACE INTO `{$this->mySqlTablePrefix}elementGroup`(`owner`, `type`, `element`, `group`) VALUES";
    foreach($groups as $group)
    {
      if(strlen($group) > 0)
      {
        $sql .= sprintf("('%s', '%s', '%s', '%s'),", $this->_($this->owner), $this->_($type), $this->_($id), $this->_($group));
        $hasGroup = true;
      }
    }
    if(!$hasGroup)
      return false;
    $sql = substr($sql, 0, -1);
    $res = $this->db->execute($sql);
    return $res !== false;
  }
private function addGroupsToElement ( $ id , $ groups , $ type ) { if ( empty ( $ id ) || empty ( $ groups ) || empty ( $ type ) ) return false ; $ hasGroup = false ; $ sql = " REPLACE INTO ` { $ this -> mySqlTablePrefix } elementGroup`(`owner`, `type`, `element`, `group`) VALUES " ; foreach ( $ groups as $ group ) { if ( strlen ( $ group ) > 0 ) { $ sql .= sprintf ( " ('%s', '%s', '%s', '%s'), " , $ this -> _ ( $ this -> owner ) , $ this -> _ ( $ type ) , $ this -> _ ( $ id ) , $ this -> _ ( $ group ) ) ; $ hasGroup = true ; } } if ( ! $ hasGroup ) return false ; $ sql = substr ( $ sql , 0 , - 1 ) ; $ res = $ this -> db -> execute ( $ sql ) ; return $ res !== false ; }
Insert groups into the mapping table
 @param string $id Element id (id of the photo or video)
 @param string $groups Groups to be added
 @param string $type Element type (photo or video)
 @return boolean
Insert groups into the mapping table @param string $id Element id ( id of the photo or video ) @param string $groups Groups to be added @param string $type Element type ( photo or video ) @return boolean