/** * 删除meta信息 */ public function deleteByFileId($fileId) { $criteria = new CDbCriteria(); $criteria->condition = "file_id=:file_id"; $criteria->params = array("file_id" => $fileId); FileTag::model()->deleteAll($criteria); return true; }
/** * 删除指定用户的所有标签 * * @param $user_id 用户编号 * * @since 1.0.7 */ public function deleteUserAllTag($user_id) { $tags = $this->findAll('user_id=:user_id', array(':user_id' => $user_id)); foreach ($tags as $tag) { //删除文件标签关系 FileTag::model()->deleteAll('tag_id=:tag_id', array(':tag_id' => $tag["id"])); //删除用户标签 $tag->delete(); } }
public function GetTags() { $query = "SELECT * FROM phpmmo_storage_tags, phpmmo_storage_file_tags WHERE phpmmo_storage_file_tags.file_id = " . $this->ID . " AND phpmmo_storage_tags.tag_id = phpmmo_storage_file_tags.tag_id"; $result = mysql_query($query); $count = mysql_num_rows($result); $retval = array(); for ($i = 0; $i < $count; $i++) { $values = mysql_fetch_assoc($result); $retval[] = FileTag::GetByAssoc($values); } return $retval; }