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


PHP XoopsTree::getAllChild方法代码示例

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


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

示例1: getAllChildTopics

 function getAllChildTopics()
 {
     $ret = array();
     $xt = new XoopsTree($this->table, "topic_id", "topic_pid");
     $topic_arr = $xt->getAllChild($this->topic_id, "topic_title");
     if (is_array($topic_arr) && count($topic_arr)) {
         foreach ($topic_arr as $topic) {
             $ret[] = new XoopsTopic($this->table, $topic);
         }
     }
     return $ret;
 }
开发者ID:koki-h,项目名称:xoops_utf8,代码行数:12,代码来源:xoopstopic.php

示例2: delete

 function delete()
 {
     $sql = sprintf("DELETE FROM %s WHERE post_id = %u", $this->db->prefix("xhnewbb_posts"), $this->post_id);
     if (!($result = $this->db->query($sql))) {
         return false;
     }
     $sql = sprintf("DELETE FROM %s WHERE post_id = %u", $this->db->prefix("xhnewbb_posts_text"), $this->post_id);
     if (!($result = $this->db->query($sql))) {
         echo "Could not remove posts text for Post ID:" . $this->post_id . ".<br />";
     }
     if (!empty($this->uid)) {
         $sql = sprintf("UPDATE %s SET posts=posts-1 WHERE uid = %u", $this->db->prefix("users"), $this->uid);
         if (!($result = $this->db->query($sql))) {
             //	echo "Could not update user posts.";
         }
     }
     if ($this->istopic()) {
         $sql = sprintf("DELETE FROM %s WHERE topic_id = %u", $this->db->prefix("xhnewbb_topics"), $this->topic_id);
         if (!($result = $this->db->query($sql))) {
             echo "Could not delete topic.";
         }
         // u2t table
         $this->db->query("DELETE FROM " . $this->db->prefix("xhnewbb_users2topics") . " WHERE topic_id = {$this->topic_id}");
         // end of u2t table
     }
     include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
     $mytree = new XoopsTree($this->db->prefix("xhnewbb_posts"), "post_id", "pid");
     $arr = $mytree->getAllChild($this->post_id);
     $size = count($arr);
     if ($size > 0) {
         for ($i = 0; $i < $size; $i++) {
             $sql = sprintf("DELETE FROM %s WHERE post_id = %u", $this->db->prefix("xhnewbb_posts"), $arr[$i]['post_id']);
             if (!($result = $this->db->query($sql))) {
                 echo "Could not delete post " . $arr[$i]['post_id'] . "";
             }
             $sql = sprintf("DELETE FROM %s WHERE post_id = %u", $this->db->prefix("xhnewbb_posts_text"), $arr[$i]['post_id']);
             if (!($result = $this->db->query($sql))) {
                 echo "Could not delete post text " . $arr[$i]['post_id'] . "";
             }
             if (!empty($arr[$i]['uid'])) {
                 $sql = "UPDATE " . $this->db->prefix("users") . " SET posts=posts-1 WHERE uid=" . $arr[$i]['uid'] . "";
                 if (!($result = $this->db->query($sql))) {
                     //	echo "Could not update user posts.";
                 }
             }
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:48,代码来源:class.forumposts.php

示例3: delete

 function delete(&$post, $isDeleteOne = true, $force = false)
 {
     if (!is_object($post) || $post->getVar('post_id') == 0) {
         return false;
     }
     if ($isDeleteOne) {
         if ($post->isTopic()) {
             $criteria = new CriteriaCompo(new Criteria("topic_id", $post->getVar('topic_id')));
             $criteria->add(new Criteria('approved', 1));
             $criteria->add(new Criteria('pid', 0, ">"));
             if ($this->getPostCount($criteria) > 0) {
                 return false;
             }
         }
         return $this->_delete($post, $force);
     } else {
         require_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
         $mytree = new XoopsTree($this->db->prefix("bb_posts"), "post_id", "pid");
         $arr = $mytree->getAllChild($post->getVar('post_id'));
         for ($i = 0; $i < count($arr); $i++) {
             $childpost =& $this->create(false);
             $childpost->assignVars($arr[$i]);
             $this->_delete($childpost, $force);
             unset($childpost);
         }
         $this->_delete($post, $force);
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:29,代码来源:post.php

示例4: delete

 function delete(&$post, $isDeleteOne = true)
 {
     if ($isDeleteOne) {
         return $this->_delete($post);
     } else {
         include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
         $mytree = new XoopsTree($this->db->prefix("bb_posts"), "post_id", "pid");
         $arr = $mytree->getAllChild($post->getVar('post_id'));
         for ($i = 0; $i < count($arr); $i++) {
             $childpost =& $this->create(false);
             $childpost->assignVars($arr[$i]);
             $this->_delete($childpost);
             unset($childpost);
         }
         $this->_delete($post);
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:soopa,代码行数:18,代码来源:post.php

示例5: delete

 function delete()
 {
     $sql = sprintf("DELETE FROM %s WHERE comment_id = %u", $this->ctable, $this->getVar('comment_id'));
     if (!($result = $this->db->query($sql))) {
         return false;
     }
     $sql = sprintf("UPDATE %s SET posts = posts-1 WHERE uid = %u", $this->db->prefix("users"), $this->getVar("user_id"));
     if (!($result = $this->db->query($sql))) {
         echo "Could not update user posts.";
     }
     $mytree = new XoopsTree($this->ctable, "comment_id", "pid");
     $arr = $mytree->getAllChild($this->getVar("comment_id"), "comment_id");
     $size = count($arr);
     if ($size > 0) {
         for ($i = 0; $i < $size; $i++) {
             $sql = sprintf("DELETE FROM %s WHERE comment_bid = %u", $this->ctable, $arr[$i]['comment_id']);
             if (!($result = $this->db->query($sql))) {
                 echo "Could not delete comment.";
             }
             $sql = sprintf("UPDATE %s SET posts = posts-1 WHERE uid = %u", $this->db->prefix("users"), $arr[$i]['user_id']);
             if (!($result = $this->db->query($sql))) {
                 echo "Could not update user posts.";
             }
         }
     }
     return $size + 1;
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:27,代码来源:xoopscomments.php

示例6: getAllChild

	function getAllChild(){
		$ret = array();
		$xt = new XoopsTree($this->table, "id", "pid");

// bug fix: constant parse error: orders -> "orders"
//		$category_arr = $xt->getAllChild($this->id, orders);
		$category_arr = $xt->getAllChild($this->id, "orders");

		if ( is_array($category_arr) && count($category_arr) ) {
			foreach($category_arr as $category){
				$ret[] = new WfsCategory($category);
			}
		}
		return $ret;
	}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:15,代码来源:wfscategory.php

示例7: delete

 /**
  * Enter description here...
  *
  * @return int
  */
 public function delete()
 {
     $sql = sprintf('DELETE FROM %s WHERE comment_id = %u', $this->ctable, $this->getVar('comment_id'));
     if (!($result = $this->db->query($sql))) {
         return false;
     }
     $sql = sprintf('UPDATE %s SET posts = posts-1 WHERE uid = %u', $this->db->prefix('users'), $this->getVar('user_id'));
     if (!($result = $this->db->query($sql))) {
         echo 'Could not update user posts.';
     }
     $mytree = new XoopsTree($this->ctable, 'comment_id', 'pid');
     $arr = $mytree->getAllChild($this->getVar('comment_id'), 'comment_id');
     $size = count($arr);
     if ($size > 0) {
         for ($i = 0; $i < $size; ++$i) {
             $sql = sprintf('DELETE FROM %s WHERE comment_bid = %u', $this->ctable, $arr[$i]['comment_id']);
             if (!($result = $this->db->query($sql))) {
                 echo 'Could not delete comment.';
             }
             $sql = sprintf('UPDATE %s SET posts = posts-1 WHERE uid = %u', $this->db->prefix('users'), $arr[$i]['user_id']);
             if (!($result = $this->db->query($sql))) {
                 echo 'Could not update user posts.';
             }
         }
     }
     return $size + 1;
 }
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:32,代码来源:xoopscomments.php

示例8: saveEntry


//.........这里部分代码省略.........
             $pid = 0;
             $sql_istopic = 'SELECT pid FROM ' . $this->db->prefix('xhnewbb_posts') . ' WHERE post_id = ' . $this->post_id;
             if (!($ret_istopic = $this->db->query($sql_istopic))) {
                 $this->utils->setDebugMessage(__CLASS__, 'sql_istopic error', $this->db->error());
                 return _MD_XMOBILE_DELETE_FAILED;
             }
             while ($row = $this->db->fetchArray($ret_istopic)) {
                 $pid = intval($row['pid']);
             }
             if ($pid == 0) {
                 $istopic = true;
             }
             $sql_delete_posts = "DELETE FROM " . $this->db->prefix('xhnewbb_posts') . " WHERE post_id = " . $this->post_id;
             $this->utils->setDebugMessage(__CLASS__, 'sql_delete_posts', $sql_delete_posts);
             if (!($ret_delete_posts = $this->db->query($sql_delete_posts))) {
                 $this->utils->setDebugMessage(__CLASS__, 'sql_delete_posts error', $this->db->error());
                 return _MD_XMOBILE_DELETE_FAILED;
             }
             $sql_delete_posts_text = "DELETE FROM " . $this->db->prefix('xhnewbb_posts_text') . " WHERE post_id = " . $this->post_id;
             $this->utils->setDebugMessage(__CLASS__, 'sql_delete_posts_text', $sql_delete_posts_text);
             if (!($ret_delete_posts_text = $this->db->query($sql_delete_posts_text))) {
                 $this->utils->setDebugMessage(__CLASS__, 'sql_delete_posts_text error', $this->db->error());
                 return _MD_XMOBILE_DELETE_FAILED;
             }
             $sql_decrement_posts = sprintf("UPDATE %s SET posts=posts-1 WHERE uid = %u", $this->db->prefix('users'), $poster_uid);
             $this->utils->setDebugMessage(__CLASS__, 'sql_decrement_posts', $sql_decrement_posts);
             if (!($ret_decrement_posts = $this->db->query($sql_decrement_posts))) {
                 $this->utils->setDebugMessage(__CLASS__, 'sql_decrement_posts error', $this->db->error());
                 return _MD_XMOBILE_DELETE_FAILED;
             }
             include_once XOOPS_ROOT_PATH . '/class/xoopstree.php';
             $child_count = 0;
             $mytree = new XoopsTree($this->db->prefix('xhnewbb_posts'), 'post_id', 'pid');
             $child_arr = $mytree->getAllChild($this->post_id);
             $child_count = count($child_arr);
             $post_count = $child_count + 1;
             if ($child_count > 0) {
                 foreach ($child_arr as $child) {
                     $sql_delete_posts_child = "DELETE FROM " . $this->db->prefix('xhnewbb_posts') . " WHERE pid=" . $child['post_id'];
                     $this->utils->setDebugMessage(__CLASS__, 'sql_delete_posts_child', $sql_delete_posts_child);
                     if (!($ret_delete_posts_child = $this->db->query($sql_delete_posts_child))) {
                         $this->utils->setDebugMessage(__CLASS__, 'sql_delete_posts_child error', $this->db->error());
                         return _MD_XMOBILE_DELETE_FAILED;
                     }
                     $sql_delete_posts_text_child = "DELETE FROM " . $this->db->prefix('xhnewbb_posts_text') . " WHERE post_id=" . $child['post_id'];
                     $this->utils->setDebugMessage(__CLASS__, 'sql_delete_posts_text_child', $sql_delete_posts_text_child);
                     if (!($ret_delete_posts_text_child = $this->db->query($sql_delete_posts_text_child))) {
                         $this->utils->setDebugMessage(__CLASS__, 'sql_delete_posts_text_child error', $this->db->error());
                         return _MD_XMOBILE_DELETE_FAILED;
                     }
                     $sql_decrement_posts_child = sprintf("UPDATE %s SET posts=posts-1 WHERE uid = %u", $this->db->prefix('users'), $child['uid']);
                     $this->utils->setDebugMessage(__CLASS__, 'sql_decrement_posts_child', $sql_decrement_posts_child);
                     if (!($ret_decrement_posts_child = $this->db->query($sql_decrement_posts_child))) {
                         $this->utils->setDebugMessage(__CLASS__, 'sql_decrement_posts_child error', $this->db->error());
                         return _MD_XMOBILE_DELETE_FAILED;
                     }
                 }
             }
             if ($istopic) {
                 $sql_delete_topics = "DELETE FROM " . $this->db->prefix('xhnewbb_topics') . " WHERE topic_id=" . $this->topic_id;
                 $this->utils->setDebugMessage(__CLASS__, 'sql_delete_topics', $sql_delete_topics);
                 if (!($ret_delete_topics = $this->db->query($sql_delete_topics))) {
                     $this->utils->setDebugMessage(__CLASS__, 'sql_delete_topics error', $this->db->error());
                     return _MD_XMOBILE_DELETE_FAILED;
                 }
                 $sql_delete_users2topics = "DELETE FROM " . $this->db->prefix('xhnewbb_users2topics') . " WHERE topic_id=" . $this->topic_id;
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:67,代码来源:xhnewbb.php

示例9: getAllChild

 function getAllChild()
 {
     $ret = array();
     $xt = new XoopsTree($this->table, "id", "pid");
     $category_arr = $xt->getAllChild($this->id, orders);
     if (is_array($category_arr) && count($category_arr)) {
         foreach ($category_arr as $category) {
             $ret[] = new WfsCategory($category);
         }
     }
     return $ret;
 }
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:12,代码来源:wfscategory.php


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