/** * 获取所有的父级分类(传递一个分类id返回所有父级) */ function get_all_parents($array, $id) { $arr = array(); foreach ($array as $v) { if ($v['id'] == $id) { $arr[] = $v; $arr = array_merge($arr, get_all_parents($array, $v['pid'])); } } return $arr; }
function parent_list() { $parent_set = get_all_parents(); $output = ""; while ($parent = mysql_fetch_array($parent_set)) { $output .= "<tr id=\"{$parent['hash']}\">\n\t\t\t\t<td><input type=\"checkbox\"></td>"; $output .= "<td>" . $parent['full_name'] . "</td>"; $output .= "<td>" . get_phone($parent['id'], "contacts"); $output .= "</td>"; $output .= "<td>" . get_email($parent['id'], "contacts"); $output . -"</td>"; $output .= "<td>{$parent['addedon']}</td></tr>"; } return $output; }
echo U('List/index'); ?> ">全部分类</a> <?php if (isset($_GET["id"])) { ?> > <?php } ?> <?php $cid = $_GET["id"]; if (S('location_' . $cid)) { $_location_result = S('location_' . $cid); } else { $_location_cate = M('category')->select(); $_location_result = array_reverse(get_all_parents($_location_cate, $cid)); S('location_' . $cid, $_location_result, 60); } foreach ($_location_result as $v) { extract($v); if ($id == $_GET["id"]) { echo $name; ?> <?php } else { ?> <a href="<?php echo U('List/index', array('id' => $id)); ?> "><?php echo $name;
$docComment = "/**\n * \n */"; } $explodedComment = preg_split('/\\n[ \\n\\t\\/]*\\*[ \\t]*@/', "\n" . $docComment); preg_match_all('/^[ \\t]*[\\/*]*\\**( ?.*)[ \\t\\/*]*$/m', array_shift($explodedComment), $commentMatches); if (isset($commentMatches[1])) { $classDesc = implode("\n", $commentMatches[1]); } $doc['className'] = $refClass->getName(); $doc['classDesc'] = trim($classDesc); // print_r($doc['classDesc']); $doc['methods'] = array(); $allmethods = $refClass->getMethods(ReflectionMethod::IS_PUBLIC); $allprops = $refClass->getProperties(ReflectionProperty::IS_PUBLIC); $allpropdefaults = $refClass->getDefaultProperties(); // let's go ahead and add all the methods from the parent class as well $parents = get_all_parents($className); foreach ($allmethods as $method) { $ignoreFlag = false; $methodInfo = array(); $docComment = $method->getDocComment(); if ($method->class !== $className) { //continue; } $methodInfo['name'] = $method->getName(); if ($methodInfo['name'][0] === "_") { // this is an internal method exposed as public continue; } if (strlen($docComment) > 1) { if (substr(trim($docComment), 0, 3) != '/**') { die("ERROR: The comment isn't a docstring for {$className}::{$methodName}");