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


PHP Tag::load方法代码示例

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


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

示例1: load

 /**
  * Load in the tags for the given SQL statement
  *
  * @param string $sql
  * @param array $params the parameters that go into the sql statement
  * @return TagSet (this)
  */
 function load($sql, $params)
 {
     global $DB;
     if (!isset($params)) {
         $params = array();
     }
     $resArray = $DB->select($sql, $params);
     $count = count($resArray);
     for ($i = 0; $i < $count; $i++) {
         $array = $resArray[$i];
         $r = new Tag($array["TagID"]);
         $this->add($r->load());
     }
     return $this;
 }
开发者ID:uniteddiversity,项目名称:DebateHub,代码行数:22,代码来源:tagset.class.php

示例2: load

 /**
  * Loads the data for the connection from the database
  *
  * @param String $style (optional - default 'long') may be 'short' or 'long' of 'cif'
  * @return Connection object (this) or Error
  */
 function load($style = 'long')
 {
     global $DB, $CFG, $HUB_SQL;
     try {
         $this->canview();
     } catch (Exception $e) {
         return access_denied_error();
     }
     $this->style = $style;
     $params = array();
     $params[0] = $this->connid;
     $resArray = $DB->select($HUB_SQL->DATAMODEL_CONNECTION_SELECT, $params);
     $count = count($resArray);
     if ($count == 0) {
         $ERROR = new error();
         $ERROR->createConnectionNotFoundError($this->connid);
         return $ERROR;
     }
     $fromid = 0;
     $toid = 0;
     for ($i = 0; $i < $count; $i++) {
         $array = $resArray[$i];
         $fromid = trim($array['FromID']);
         $toid = trim($array['ToID']);
         $this->fromcontexttypeid = trim($array['FromContextTypeID']);
         $this->tocontexttypeid = trim($array['ToContextTypeID']);
         $this->creationdate = trim($array['CreationDate']);
         $this->modificationdate = trim($array['ModificationDate']);
         $this->userid = trim($array['UserID']);
         $this->users = array();
         $this->users[0] = getUser($this->userid, $style);
         $this->linktypeid = trim($array['LinkTypeID']);
         $this->private = $array['Private'];
         $this->description = $array['Description'];
     }
     //now add in from/to nodes
     $from = new CNode($fromid);
     $this->from = $from->load($style);
     // we need to for the resource node title
     // $this->from->description = ""; // we don't need the long descriptions on connections - even if style for rest is long
     $to = new CNode($toid);
     $this->to = $to->load($style);
     // we need to for the resource node title
     //$this->to->description = ""; // we don't need the long descriptions on connections - even if style for rest is long
     $r = new Role($this->fromcontexttypeid);
     $this->fromrole = $r->load();
     $r = new Role($this->tocontexttypeid);
     $this->torole = $r->load();
     //If both ends of the connection are Comments, it's part of a chat tree.
     //and if the description holds a nodeid, load it as the parent item the chat is against
     if (isset($this->fromrole->name) && $this->fromrole->name == "Comment" || isset($this->torole->name) && $this->torole->name == "Comment") {
         if (isset($this->description) && $this->description != "") {
             // the description could hold a list of id'd id1:id2:id3 etc
             // if it does, the first item is the one to use.
             //echo $this->description;
             $reply = split(":", $this->description);
             $id = $reply[0];
             if ($reply[0] == "") {
                 $id = $reply[1];
             }
             $parentnode = new CNode($id);
             $parentnode = $parentnode->load();
             if (!$parentnode instanceof Error) {
                 $this->parentnode = $parentnode;
             }
         }
     }
     $l = new LinkType($this->linktypeid);
     $this->linktype = $l->load();
     if ($style == 'long') {
         // add in the groups
         $resArray2 = $DB->select($HUB_SQL->DATAMODEL_CONNECTION_SELECT_GROUP, $params);
         $count2 = count($resArray2);
         if ($count2 > 0) {
             $this->groups = array();
             for ($i = 0; $i < $count2; $i++) {
                 $array = $resArray2[$i];
                 $group = new Group(trim($array['GroupID']));
                 array_push($this->groups, $group->load());
             }
         }
         //now add in any tags
         $resArray3 = $DB->select($HUB_SQL->DATAMODEL_CONNECTION_SELECT_TAGS, $params);
         $count3 = count($resArray3);
         if ($count3 > 0) {
             $this->tags = array();
             for ($i = 0; $i < $count3; $i++) {
                 $array = $resArray3[$i];
                 $tag = new Tag(trim($array['TagID']));
                 array_push($this->tags, $tag->load());
             }
         }
     }
     if ($style != 'cif') {
//.........这里部分代码省略.........
开发者ID:uniteddiversity,项目名称:LiteMap,代码行数:101,代码来源:connection.class.php

示例3: load

 /**
  * Loads the data for the node from the database
  *
  * @return URL object (this)
  */
 function load($style = 'long')
 {
     global $DB, $ERROR, $HUB_FLM, $HUB_SQL, $HUB_CACHE, $CFG;
     try {
         $this->canview();
     } catch (Exception $e) {
         return access_denied_error();
     }
     $this->style = $style;
     if (isset($HUB_CACHE)) {
         $cachedused = $HUB_CACHE->getObjData($this->urlid . $this->style);
         if ($cachedused !== FALSE) {
             return $cachedused;
         }
     }
     $params = array();
     $params[0] = $this->urlid;
     $resArray = $DB->select($HUB_SQL->DATAMODEL_URL_SELECT, $params);
     if ($resArray !== false) {
         $count = count($resArray);
         if ($count == 0) {
             $ERROR = new error();
             $ERROR->createUrlNotFoundError($this->urlid);
             return $ERROR;
         } else {
             for ($i = 0; $i < $count; $i++) {
                 $array = $resArray[$i];
                 $this->url = stripslashes($array['URL']);
                 $this->description = stripslashes($array['Description']);
                 $this->userid = $array['UserID'];
                 $this->title = stripslashes($array['Title']);
                 $this->creationdate = $array['CreationDate'];
                 $this->modificationdate = $array['ModificationDate'];
                 $this->clip = $array['Clip'];
                 $this->private = $array['Private'];
                 if (isset($array['ClipPath'])) {
                     $this->clippath = $array['ClipPath'];
                 }
                 if (isset($array['ClipHTML'])) {
                     $this->cliphtml = $array['ClipHTML'];
                 }
                 $this->user = new user($this->userid);
                 if (isset($array['CurrentStatus'])) {
                     $this->status = $array['CurrentStatus'];
                 }
                 if (isset($array['AdditionalIdentifier'])) {
                     $this->identifier = $array['AdditionalIdentifier'];
                 }
                 if (isset($array['CreatedFrom'])) {
                     $this->createdfrom = $array['CreatedFrom'];
                 }
             }
         }
     } else {
         return database_error();
     }
     // Virtuoso required this part to be in a separate statement.
     // Was originally part of the select.
     $resArray = $DB->select($HUB_SQL->DATAMODEL_URL_IDEA_COUNT, $params);
     if ($resArray !== false) {
         $count = count($resArray);
         if ($count == 0) {
             $ERROR = new error();
             $ERROR->createUrlNotFoundError($this->urlid);
             return $ERROR;
         } else {
             for ($i = 0; $i < $count; $i++) {
                 $array = $resArray[$i];
                 $this->ideacount = $array['ideacount'];
             }
         }
     } else {
         return database_error();
     }
     if ($style == 'long') {
         //now add in any tags
         $params = array();
         $params[0] = $this->urlid;
         $resArray = $DB->select($HUB_SQL->DATAMODEL_URL_TAGS_SELECT, $params);
         if ($resArray !== false) {
             $count = count($resArray);
             if ($count > 0) {
                 $this->tags = array();
                 for ($i = 0; $i < $count; $i++) {
                     $array = $resArray[$i];
                     $tag = new Tag(trim($array['TagID']));
                     array_push($this->tags, $tag->load());
                 }
             }
         } else {
             return database_error();
         }
         // add in the groups
         $params = array();
         $params[0] = $this->urlid;
//.........这里部分代码省略.........
开发者ID:uniteddiversity,项目名称:LiteMap,代码行数:101,代码来源:url.class.php

示例4: getTag

/**
* Get a tag (by id)
*
* @param string $tagid
* @return Tag or Error
*/
function getTag($tagid)
{
    $t = new Tag($tagid);
    return $t->load();
}
开发者ID:uniteddiversity,项目名称:LiteMap,代码行数:11,代码来源:apilib.php

示例5: load

 /**
  * Loads the data for the connection from the database
  *
  * @param String $style (optional - default 'long') may be 'short' or 'long' of 'cif'
  * @return Connection object (this) or Error
  */
 function load($style = 'long')
 {
     global $DB, $CFG, $HUB_SQL;
     try {
         $this->canview();
     } catch (Exception $e) {
         return access_denied_error();
     }
     $this->style = $style;
     $params = array();
     $params[0] = $this->connid;
     $resArray = $DB->select($HUB_SQL->DATAMODEL_CONNECTION_SELECT, $params);
     $count = count($resArray);
     if ($count == 0) {
         $ERROR = new error();
         $ERROR->createConnectionNotFoundError($this->connid);
         return $ERROR;
     }
     $fromid = 0;
     $toid = 0;
     for ($i = 0; $i < $count; $i++) {
         $array = $resArray[$i];
         $fromid = trim($array['FromID']);
         $toid = trim($array['ToID']);
         $this->fromcontexttypeid = trim($array['FromContextTypeID']);
         $this->tocontexttypeid = trim($array['ToContextTypeID']);
         $this->creationdate = trim($array['CreationDate']);
         $this->modificationdate = trim($array['ModificationDate']);
         $this->userid = trim($array['UserID']);
         $this->users = array();
         $this->users[0] = getUser($this->userid, $style);
         $this->linktypeid = trim($array['LinkTypeID']);
         $this->private = $array['Private'];
         $this->description = $array['Description'];
     }
     //now add in from/to nodes. Try from the cache first?
     $from = new CNode($fromid);
     $this->from = $from->load($style);
     $to = new CNode($toid);
     $this->to = $to->load($style);
     $r = new Role($this->fromcontexttypeid);
     $this->fromrole = $r->load();
     $r = new Role($this->tocontexttypeid);
     $this->torole = $r->load();
     $l = new LinkType($this->linktypeid);
     $this->linktype = $l->load();
     if ($style == 'long') {
         // add in the groups
         $resArray2 = $DB->select($HUB_SQL->DATAMODEL_CONNECTION_SELECT_GROUP, $params);
         $count2 = count($resArray2);
         if ($count2 > 0) {
             $this->groups = array();
             for ($i = 0; $i < $count2; $i++) {
                 $array = $resArray2[$i];
                 $group = new Group(trim($array['GroupID']));
                 array_push($this->groups, $group->load());
             }
         }
         //now add in any tags
         $resArray3 = $DB->select($HUB_SQL->DATAMODEL_CONNECTION_SELECT_TAGS, $params);
         $count3 = count($resArray3);
         if ($count3 > 0) {
             $this->tags = array();
             for ($i = 0; $i < $count3; $i++) {
                 $array = $resArray3[$i];
                 $tag = new Tag(trim($array['TagID']));
                 array_push($this->tags, $tag->load());
             }
         }
     }
     if ($style != 'cif') {
         $this->loadVotes();
     }
     return $this;
 }
开发者ID:uniteddiversity,项目名称:DebateHub,代码行数:81,代码来源:connection.class.php

示例6: load

 /**
  * Loads the data for the user from the database
  * This will not return a "group" (even though groups are
  * stored in the Users table)
  *
  * @param String $style (optional - default 'long') may be 'short' or 'long'
  * @return User object (this) (or Error object)
  */
 function load($style = 'long')
 {
     global $DB, $USER, $CFG, $ERROR, $HUB_FLM, $HUB_SQL, $HUB_CACHE;
     $this->style = $style;
     if (isset($HUB_CACHE)) {
         $cachedused = $HUB_CACHE->getObjData($this->userid . $style);
         if ($cachedused !== FALSE) {
             return $cachedused;
         }
     }
     $params = array();
     $params[0] = $this->userid;
     $resArray = $DB->select($HUB_SQL->DATAMODEL_USER_SELECT, $params);
     if ($resArray !== false) {
         $count = count($resArray);
         if ($count == 0) {
             $ERROR = new error();
             $ERROR->createUserNotFoundError($this->userid);
             return $ERROR;
         } else {
             for ($i = 0; $i < $count; $i++) {
                 $array = $resArray[$i];
                 $this->name = stripslashes($array['Name']);
                 $this->isgroup = $array['IsGroup'];
                 $this->creationdate = $array['CreationDate'];
                 $this->testgroup = $array['TestGroup'];
                 if ($array['Photo']) {
                     //set user photo and thumb the thumb creation is done during registration
                     $originalphotopath = $HUB_FLM->createUploadsDirPath($this->userid . "/" . stripslashes($array['Photo']));
                     if (file_exists($originalphotopath)) {
                         $this->photo = $HUB_FLM->getUploadsWebPath($this->userid . "/" . stripslashes($array['Photo']));
                         $this->thumb = $HUB_FLM->getUploadsWebPath($this->userid . "/" . str_replace('.', '_thumb.', stripslashes($array['Photo'])));
                         if (!file_exists($this->thumb)) {
                             create_image_thumb($array['Photo'], $CFG->IMAGE_THUMB_WIDTH, $this->userid);
                         }
                     } else {
                         //if the file does not exists how to get it from a upper level? change it to
                         //if file doesnot exists directly using default photo
                         if ($this->isgroup == "Y") {
                             $this->photo = $HUB_FLM->getUploadsWebPath($CFG->DEFAULT_GROUP_PHOTO);
                             $this->thumb = $HUB_FLM->getUploadsWebPath(str_replace('.', '_thumb.', stripslashes($CFG->DEFAULT_GROUP_PHOTO)));
                         } else {
                             $this->photo = $HUB_FLM->getUploadsWebPath($CFG->DEFAULT_USER_PHOTO);
                             $this->thumb = $HUB_FLM->getUploadsWebPath(str_replace('.', '_thumb.', stripslashes($CFG->DEFAULT_USER_PHOTO)));
                         }
                     }
                 } else {
                     if ($this->isgroup == "Y") {
                         $this->photo = $HUB_FLM->getUploadsWebPath($CFG->DEFAULT_GROUP_PHOTO);
                         $this->thumb = $HUB_FLM->getUploadsWebPath(str_replace('.', '_thumb.', stripslashes($CFG->DEFAULT_GROUP_PHOTO)));
                     } else {
                         $this->photo = $HUB_FLM->getUploadsWebPath($CFG->DEFAULT_USER_PHOTO);
                         $this->thumb = $HUB_FLM->getUploadsWebPath(str_replace('.', '_thumb.', stripslashes($CFG->DEFAULT_USER_PHOTO)));
                     }
                 }
                 $this->lastlogin = $array['LastLogin'];
                 $this->followsendemail = $array['FollowSendEmail'];
                 $this->followruninterval = $array['FollowRunInterval'];
                 $this->followlastrun = $array['FollowLastRun'];
                 if (isset($array['Newsletter'])) {
                     $this->newsletter = $array['Newsletter'];
                 }
                 if (isset($array['RecentActivitiesEmail'])) {
                     $this->recentactivitiesemail = $array['RecentActivitiesEmail'];
                 }
                 if (isset($array['CurrentStatus'])) {
                     $this->status = $array['CurrentStatus'];
                 }
                 if ($style == 'long') {
                     $this->description = stripslashes($array['Description']);
                     $this->modificationdate = $array['ModificationDate'];
                     $this->privatedata = $array['Private'];
                     $this->isadmin = $array['IsAdministrator'];
                     $this->authtype = $array['AuthType'];
                     $this->password = $array['Password'];
                     $this->website = $array['Website'];
                     $this->email = $array['Email'];
                     if (isset($array['Interest'])) {
                         $this->interest = $array['Interest'];
                     }
                     if (isset($array['LocationText'])) {
                         $this->location = $array['LocationText'];
                     } else {
                         $this->location = "";
                     }
                     if (isset($array['LocationCountry'])) {
                         $cs = getCountryList();
                         $this->countrycode = $array['LocationCountry'];
                         if (isset($cs[$array['LocationCountry']])) {
                             $this->country = $cs[$array['LocationCountry']];
                         }
                     } else {
//.........这里部分代码省略.........
开发者ID:uniteddiversity,项目名称:LiteMap,代码行数:101,代码来源:user.class.php

示例7: getTagIdByValue

 function getTagIdByValue($value)
 {
     $t = new Tag($this->POD);
     $t->load('value', $value);
     if ($t->success()) {
         return $t->get('id');
     } else {
         $t->set('value', $value);
         $t->save();
         return $t->get('id');
     }
 }
开发者ID:RichieDupes,项目名称:PeoplePods,代码行数:12,代码来源:Content.php

示例8: removeTag

 /**
  * Remove a Tag from this node
  *
  * @param string $urlid
  * @return Node object (this) (or Error object)
  */
 function removeTag($tagid)
 {
     global $DB, $CFG, $USER, $HUB_SQL;
     //check user can edit the node
     try {
         $this->canedit();
     } catch (Exception $e) {
         return access_denied_error();
     }
     //check user can edit the Tag
     $tag = new Tag($tagid);
     $tag - $tag->load();
     try {
         $tag->canedit();
     } catch (Exception $e) {
         return access_denied_error();
     }
     $currentuser = '';
     if (isset($USER->userid)) {
         $currentuser = $USER->userid;
     }
     $params = array();
     $params[0] = $this->nodeid;
     $params[1] = $tagid;
     $params[2] = $currentuser;
     $res = $DB->delete($HUB_SQL->DATAMODEL_NODE_TAG_DELETE, $params);
     if (!$res) {
         return database_error();
     }
     return $this->load();
 }
开发者ID:uniteddiversity,项目名称:LiteMap,代码行数:37,代码来源:node.class.php

示例9: loadTags

 /**
  * Load associated tags
  */
 function loadTags()
 {
     global $DB, $CFG, $USER, $HUB_SQL;
     $params = array();
     $params[0] = $this->nodeid;
     $resArray = $DB->select($HUB_SQL->DATAMODEL_NODE_TAGS, $params);
     if ($resArray !== false) {
         $count = count($resArray);
         if (count($resArray) > 0) {
             $this->tags = array();
             for ($i = 0; $i < $count; $i++) {
                 $array = $resArray[$i];
                 $tag = new Tag(trim($array['TagID']));
                 array_push($this->tags, $tag->load());
             }
         }
     } else {
         return database_error();
     }
 }
开发者ID:uniteddiversity,项目名称:DebateHub,代码行数:23,代码来源:node.class.php

示例10: load_map

 /**
  * リポジトリサーバのマッピングファイルを読み込む
  */
 public static function load_map()
 {
     $path = App::path("__repository__.xml");
     if (Tag::load($tag, $path, "map")) {
         foreach ($tag->in("repository") as $rep) {
             if ($rep->is_param("domain")) {
                 $url = $rep->in_param("url", "http://" . $rep->in_param("domain"));
                 if (substr($url, -1) === "/") {
                     $url = substr($url, 0, -1);
                 }
                 self::$server_alias[$rep->in_param("domain")] = $url;
             }
         }
     }
 }
开发者ID:satully,项目名称:dev_socialapp,代码行数:18,代码来源:Repository.php

示例11: addTag

 function addTag($tag)
 {
     $this->success = false;
     if ($this->get('id')) {
         $t = new Tag($this->POD);
         $t->load('value', $tag);
         if (!$t->success()) {
             $this->POD->tolog("content->addTag: Adding tag {$tag}");
             $t->set('value', $tag);
             $t->save();
         }
         $sql = "DELETE FROM tagRef WHERE itemId=" . $this->get('id') . " AND type='" . $this->TYPE . "' AND tagId=" . $t->get('id') . ';';
         $this->POD->tolog($sql, 2);
         mysql_query($sql, $this->POD->DATABASE);
         $sql = "INSERT INTO tagRef(itemId,tagId,type) VALUES (" . $this->get('id') . "," . $t->get('id') . ",'" . $this->TYPE . "');";
         $this->POD->tolog($sql, 2);
         mysql_query($sql, $this->POD->DATABASE);
         $this->tags()->add($t);
         $this->success = true;
         return $t;
     } else {
         $this->throwError("Object not saved yet!");
         $this->error_code = 500;
         return null;
     }
 }
开发者ID:RichieDupes,项目名称:PeoplePods,代码行数:26,代码来源:Obj.php


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