当前位置: 首页>>代码示例>>PHP>>正文


PHP Tag::setTag方法代码示例

本文整理汇总了PHP中Tag::setTag方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::setTag方法的具体用法?PHP Tag::setTag怎么用?PHP Tag::setTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tag的用法示例。


在下文中一共展示了Tag::setTag方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: recordTags

 public static function recordTags($phrase, $model, $obj)
 {
     $tags = TagTools::splitPhrase($phrase);
     foreach ($tags as $settag) {
         $tag = new Tag();
         if ($model == "etime") {
             $modelTag = new EtimeTag();
         } else {
             $modelTag = new EventTag();
         }
         $tag->setTag($settag);
         $c = new Criteria();
         $c->add(TagPeer::NORMALIZED_TAG, $tag->getNormalizedTag());
         $tag_exists = TagPeer::doSelectOne($c);
         if (!$tag_exists) {
             $tag->save();
         } else {
             $tag = $tag_exists;
         }
         if ($model == "etime") {
             $modelTag->setEtime($obj);
         } else {
             $modelTag->setEvent($obj);
         }
         $modelTag->setTag($tag);
         $modelTag->save();
     }
     return true;
 }
开发者ID:soon0009,项目名称:EMS,代码行数:29,代码来源:TagTools.class.php

示例2: controlerJob

 public function controlerJob($maincont)
 {
     if ($maincont->isLoggued()) {
         if (isset($_POST["title"])) {
             $p = new Post();
             $p->setTitle($_POST["title"]);
             $p->setBody($_POST["body"]);
             $p->setHour(date("h:i:s"));
             $p->setDate(date("Y-m-d"));
             // gestion des tags
             $tags = explode(" ", $_POST["tags"]);
             foreach ($tags as $t) {
                 if ($t == "") {
                     continue;
                 }
                 $ta = Tag::getByTag($t);
                 //echo "Tag : $t<br />";
                 if (count($ta) == 0) {
                     $mytag = new Tag();
                     $mytag->setTag($t);
                 } else {
                     $mytag = $ta[0];
                 }
                 // création du posttag liant le tag et le post
                 $pt = new Posttag();
                 $pt->setPostid($p->id);
                 $pt->setTagid($mytag->id);
             }
         }
         $maincont->goModule("post", "admin");
     } else {
         $maincont->goModule("home", "display");
     }
 }
开发者ID:rogerwilko,项目名称:Yet-Another-Blog,代码行数:34,代码来源:controler.php

示例3: create

 public function create()
 {
     if (isset($_POST["tag"])) {
         $tag = new Tag();
         $tag->setTag($_POST["tag"]);
         $result_e = $tag->insert();
     }
     $this->redirect("Tags", "index");
 }
开发者ID:Magicvan,项目名称:simple_mvc,代码行数:9,代码来源:TagsController.php

示例4: setObjectTags

 /**
  * Set tags for specific object
  *
  * @access public
  * @param array $tags Array of tags... Can be NULL or empty
  * @param ProjectDataObject $object
  * @param string $manager_class
  * @param Project $project
  * @return null
  */
 function setObjectTags($tags, ProjectDataObject $object, $manager_class, $project = null)
 {
     self::clearObjectTags($object, $manager_class);
     if (is_array($tags) && count($tags)) {
         foreach ($tags as $tag_name) {
             if (trim($tag_name) != '') {
                 $tag = new Tag();
                 if ($project instanceof Project) {
                     $tag->setProjectId($project->getId());
                 }
                 $tag->setTag($tag_name);
                 $tag->setRelObjectId($object->getId());
                 $tag->setRelObjectManager($manager_class);
                 $tag->setIsPrivate($object->isPrivate());
                 $tag->save();
             }
             // if
         }
         // foreach
     }
     // if
     return true;
 }
开发者ID:swenson,项目名称:projectpier,代码行数:33,代码来源:Tags.class.php

示例5: setObjectTags

 /**
  * Set tags for specific object
  *
  * @access public
  * @param array $tags Array of tags... Can be NULL or empty
  * @param ProjectDataObject $object
  * @param string $manager_class
  * @return null
  */
 function setObjectTags($tags, ProjectDataObject $object, $manager_class)
 {
     self::clearObjectTags($object, $manager_class);
     if (is_array($tags) && count($tags)) {
         foreach ($tags as $tag_name) {
             if (trim($tag_name) != '') {
                 $tag = new Tag();
                 $tag->setTag($tag_name);
                 $tag->setRelObjectId($object->getId());
                 $tag->setRelObjectManager($manager_class);
                 $tag->setIsPrivate($object->isPrivate());
                 $tag->save();
                 evt_add("tag added", array("name" => $tag_name));
             }
             // if
         }
         // foreach
     }
     // if
     return true;
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:30,代码来源:Tags.class.php

示例6: addTags

 /**
  * Function creates new propel Tag objects and saves them.
  * @param array $tagToAdd
  */
 protected function addTags($tagsToAdd, $objectType, $partnerId)
 {
     foreach ($tagsToAdd as $tagToAdd) {
         if (strlen($tagToAdd) >= TagSearchPlugin::MIN_TAG_SEARCH_LENGTH) {
             $tag = new Tag();
             $tag->setTag(trim($tagToAdd));
             $tag->setObjectType($objectType);
             $tag->setPartnerId($partnerId);
             $tag->save();
         }
     }
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:16,代码来源:kTagFlowManager.php

示例7: addTag

 /**
  * Add a tag to the object.
  *
  * @access public
  * @param void
  * @return boolean
  */
 function addTag($tag_name)
 {
     $tag = new Tag();
     $tag->setTag($tag_name);
     $tag->setRelObjectId($this->getId());
     $tag->setRelObjectManager(get_class($this->manager()));
     $tag->setIsPrivate($this->isPrivate());
     $tag->save();
     $this->tags = null;
     if ($this->isSearchable()) {
         $this->addTagsToSearchableObject();
     }
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:20,代码来源:ProjectDataObject.class.php

示例8: trimObjectTags

        if (!$numTagsFound) {
            $requiredTags = $entryTags;
        } else {
            $crit = new Criteria();
            $crit->addAnd(TagPeer::ID, $c->getFetchedIds(), KalturaCriteria::IN);
            $foundTagObjects = TagPeer::doSelect($crit);
            $foundTags = array();
            foreach ($foundTagObjects as $foundTag) {
                $foundTag->incrementInstanceCount();
                $foundTags[] = $foundTag->getTag();
            }
            $requiredTags = array_diff($entryTags, $foundTags);
        }
        foreach ($requiredTags as $tagString) {
            $tag = new Tag();
            $tag->setTag($tagString);
            $tag->setPartnerId($entry->getPartnerId());
            $tag->setObjectType(taggedObjectType::ENTRY);
            $tag->save();
        }
    }
    $countLimitEachLoop += $countLimitEachLoop;
    $c->setOffset($countLimitEachLoop);
    $entryResults = entryPeer::doSelect($c, $con);
    usleep(100);
}
function trimObjectTags($tagsString)
{
    $arr = explode(",", $tagsString);
    for ($i = 0; $i < count($arr); $i++) {
        $arr[$i] = trim($arr[$i]);
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:31,代码来源:migrateTags.php


注:本文中的Tag::setTag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。