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


PHP Tags::insert方法代码示例

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


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

示例1: insertRel

 private function insertRel($value)
 {
     try {
         $this->log->addInfo("Inicia funcion MainPeople::insertRel() ");
         $tags = new Tags();
         $rel = array(0, "lkp_persons", $value->id);
         $tags->insert($rel);
     } catch (\Excetion $e) {
         $this->log->addError($e->getMessage(), array(basename(__FILE__) . "::" . __LINE__));
     }
 }
开发者ID:javierTerry,项目名称:api-teamwork,代码行数:11,代码来源:MainPeople.php

示例2: GET

$bold = GET('newbold') != "" ? 1 : 0;
ossim_valid($id, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("id"));
ossim_valid($delete, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("delete"));
ossim_valid($name, OSS_DIGIT, OSS_ALPHA, OSS_SPACE, OSS_NULLABLE, 'illegal:' . _("name"));
ossim_valid($bgcolor, OSS_DIGIT, OSS_ALPHA, OSS_NULLABLE, 'illegal:' . _("bgcolor"));
ossim_valid($fgcolor, OSS_DIGIT, OSS_ALPHA, OSS_NULLABLE, 'illegal:' . _("fgcolor"));
ossim_valid($italic, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("italic"));
ossim_valid($bold, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("bold"));
if (ossim_error()) {
    die(ossim_error());
}
if (GET('mode') == "insert") {
    if ($name == "") {
        $msg = _("You must type a name for the tab.");
    } else {
        $id = Tags::insert($conn, $name, $bgcolor, $fgcolor, $italic, $bold);
        $msg = _("Tag successfully created.");
    }
} elseif (GET('mode') == "update" && $id != "") {
    if ($name == "") {
        $msg = _("You must type a name for the tab.");
    } else {
        Tags::update($conn, $id, $name, $bgcolor, $fgcolor, $italic, $bold);
        $msg = _("Tag successfully saved.");
    }
    $id = "";
}
if (GET('delete') != "") {
    Tags::delete($conn, $delete);
}
?>
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:tags_edit.php

示例3: addResource

 /**
  * Add a resource to the user's account.
  *
  * @param object $resource        The resource to add.
  * @param object $list            The list to store the resource in.
  * @param array  $tagArray        An array of tags to associate with the
  * resource.
  * @param string $notes           User notes about the resource.
  * @param bool   $replaceExisting Whether to replace all existing tags (true)
  * or append to the existing list (false).
  *
  * @return bool
  * @access public
  */
 public function addResource($resource, $list, $tagArray, $notes, $replaceExisting = true)
 {
     $join = new User_resource();
     $join->user_id = $this->id;
     $join->resource_id = $resource->id;
     $join->list_id = $list->id;
     if ($join->find(true)) {
         $join->notes = $notes;
         $join->update();
         // update() will return false if we save without making any changes,
         // but we always want to report success after this point.
         $result = true;
     } else {
         if ($notes) {
             $join->notes = $notes;
         }
         $result = $join->insert();
     }
     if ($result) {
         $join = new Resource_tags();
         $join->resource_id = $resource->id;
         $join->user_id = $this->id;
         $join->list_id = $list->id;
         if ($replaceExisting) {
             // Delete old tags -- note that we need to clone $join for this
             // operation or else it will be broken when we use it for searching
             // below.
             $killer = clone $join;
             $killer->delete();
         }
         // Add new tags, if any:
         if (is_array($tagArray) && count($tagArray)) {
             foreach ($tagArray as $value) {
                 $value = str_replace('"', '', $value);
                 $tag = new Tags();
                 $tag->tag = $value;
                 if (!$tag->find(true)) {
                     $tag->insert();
                 }
                 $join->tag_id = $tag->id;
                 // Don't save duplicate tags!
                 if (!$join->find(false)) {
                     $join->insert();
                 }
             }
         }
         // Update list modification date
         $list->updateModifiedDate();
         return true;
     } else {
         return false;
     }
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:67,代码来源:User.php

示例4: addTag

 function addTag($tag, $user)
 {
     require_once ROOT_DIR . '/services/MyResearch/lib/Tags.php';
     require_once ROOT_DIR . '/services/MyResearch/lib/Resource_tags.php';
     $tags = new Tags();
     $tags->tag = $tag;
     if (!$tags->find(true)) {
         $tags->insert();
     }
     $rTag = new Resource_tags();
     $rTag->resource_id = $this->id;
     $rTag->tag_id = $tags->id;
     $rTag->user_id = $user->id;
     if (!$rTag->find()) {
         $rTag->insert();
     }
     return true;
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:18,代码来源:Resource.php

示例5: addTag

 public function addTag($id, $tag_id)
 {
     $data['parent_name'] = $this->_name;
     $data['parent_id'] = $id;
     $data['tag_id'] = $tag_id;
     $Table = new Tags();
     $Table->insert($data);
 }
开发者ID:shadobladez,项目名称:erp2,代码行数:8,代码来源:Application.php

示例6: addResource

 /**
  * @param Resource $resource
  * @param User_list $list
  * @param string[] $tagArray
  * @param string $notes
  * @param bool $updateSolr
  * @return bool
  */
 function addResource($resource, $list, $tagArray, $notes, $updateSolr = true)
 {
     require_once 'User_resource.php';
     require_once 'Tags.php';
     $join = new User_resource();
     $join->user_id = $this->id;
     $join->resource_id = $resource->id;
     $join->list_id = $list->id;
     if ($join->find(true)) {
         if ($notes) {
             $join->notes = $notes;
             $join->update();
         }
         $result = true;
     } else {
         if ($notes) {
             $join->notes = $notes;
         }
         $result = $join->insert();
     }
     if ($result) {
         if (is_array($tagArray) && count($tagArray)) {
             require_once 'Resource_tags.php';
             $join = new Resource_tags();
             $join->resource_id = $resource->id;
             $join->user_id = $this->id;
             $join->list_id = $list->id;
             $join->delete();
             foreach ($tagArray as $value) {
                 $value = trim(strtolower(str_replace('"', '', $value)));
                 $tag = new Tags();
                 $tag->tag = $value;
                 if (!$tag->find(true)) {
                     $tag->insert();
                 }
                 $join->tag_id = $tag->id;
                 $join->insert();
             }
         }
         if ($updateSolr) {
             $list->updateDetailed(true);
         }
         //Make a call to strands to update that the item was added to the list
         global $configArray;
         if (isset($configArray['Strands']['APID'])) {
             if ($resource->source == 'eContent') {
                 $strandsUrl = "http://bizsolutions.strands.com/api2/event/addtofavorites.sbs?apid={$configArray['Strands']['APID']}&item={$resource->record_id}&user={$this->id}";
             } else {
                 $strandsUrl = "http://bizsolutions.strands.com/api2/event/addtofavorites.sbs?apid={$configArray['Strands']['APID']}&item=econtentRecord{$resource->record_id}&user={$this->id}";
             }
             file_get_contents($strandsUrl);
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:65,代码来源:User.php

示例7: addTag

 /**
  * Add a tag to the current resource.
  *
  * @param string $tag  The tag to save.
  * @param object $user The user posting the tag.
  *
  * @return bool        True on success, false on failure.
  * @access public
  */
 public function addTag($tag, $user)
 {
     $tag = trim($tag);
     if (!empty($tag)) {
         include_once 'services/MyResearch/lib/Tags.php';
         include_once 'services/MyResearch/lib/Resource_tags.php';
         $tags = new Tags();
         $tags->tag = $tag;
         if (!$tags->find(true)) {
             $tags->insert();
         }
         $rTag = new Resource_tags();
         $rTag->resource_id = $this->id;
         $rTag->tag_id = $tags->id;
         if (!$rTag->find()) {
             $rTag->user_id = $user->id;
             $rTag->insert();
         }
     }
     return true;
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:30,代码来源:Resource.php


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