本文整理汇总了PHP中StringUtil::getTree方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtil::getTree方法的具体用法?PHP StringUtil::getTree怎么用?PHP StringUtil::getTree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringUtil
的用法示例。
在下文中一共展示了StringUtil::getTree方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCategory
public function getCategory()
{
$category = new ICCategory("ArticleCategory");
$data = $category->getData();
$format = "<li> <a href='#news' onclick='news.loadList(\$catid)'>\$spacer<i class='ao-file'></i>\$name</a> </li>";
$return = StringUtil::getTree($data, $format, 0, " ", array("", "", ""));
return $return;
}
示例2: actionCategory
public function actionCategory()
{
$category = OfficialdocCategory::model()->fetchAll();
$tmp = array(array());
$data = array_merge($tmp, $category);
unset($data[0]);
$params = StringUtil::getTree($data, "<li class='\$selected'><a href='#docs' onclick='docs.loadList(\$catid)'>\$spacer<i class='ao-file'></i>\$name</a></li>");
$this->ajaxReturn($params, "JSONP");
}
示例3: actionIndex
public function actionIndex()
{
$op = EnvUtil::getRequest("op");
if (!empty($op) && in_array($op, array("get"))) {
return $this->{$op}();
}
$dept = DepartmentUtil::loadDepartment();
$data = array("dept" => $dept, "tree" => StringUtil::getTree($dept, $this->selectFormat), "unit" => Ibos::app()->setting->get("setting/unit"), "license" => Ibos::app()->setting->get("setting/license"), "perAdd" => Ibos::app()->user->checkAccess("organization/department/add"), "perEdit" => Ibos::app()->user->checkAccess("organization/department/edit"), "perDel" => Ibos::app()->user->checkAccess("organization/department/del"));
$this->setPageTitle(Ibos::lang("Department manage"));
$this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Organization"), "url" => $this->createUrl("department/index")), array("name" => Ibos::lang("Department manage"), "url" => $this->createUrl("department/index")), array("name" => Ibos::lang("Department list"))));
$this->render("index", $data);
}
示例4: array
</tr>
<tr data-id='0' data-pid='0'>
<td>
<a href='<?php
echo $this->createUrl("default/index", array("op" => $op));
?>
' class='org-dep-name'><i class='os-company'></i><?php
echo isset($unit["fullname"]) ? $unit["fullname"] : "";
?>
</a>
</td>
</tr>
<?php
Yii::import("ext.Tree", true);
$str = "\n\t\t\t\t\t\t\t\t<tr data-id='\$deptid' data-pid='\$pid'>\n\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t \$spacer<a href='" . $this->createUrl("default/index&op={$op}&deptid=") . "\$deptid' class='org-dep-name'><i class='os-department'></i>\$deptname</a>\n\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t";
$categorys = StringUtil::getTree($dept, $str);
echo $categorys;
?>
</tbody>
</table>
</div>
</li>
</ul>
</div>
</div>
<script>
(function() {
var deptid = "<?php
echo EnvUtil::getRequest("deptid");
?>
",
示例5: getCategoryOption
protected function getCategoryOption()
{
$category = new ICArticleCategory("ArticleCategory");
$categoryData = $category->getAjaxCategory($category->getData(array("order" => "sort ASC")));
return StringUtil::getTree($categoryData, "<option value='\$catid' \$selected>\$spacer\$name</option>");
}
示例6: autoProcessor
//.........这里部分代码省略.........
}
break;
case "sys_manager3":
$main = Ibos::app()->user->deptid;
$deptCache = DepartmentUtil::loadDepartment();
$dept_str = Department::model()->queryDept($main);
$temp = explode(",", $dept_str);
$count = count($temp);
$dept = $temp[$count - 2];
if ($deptCache[$dept]["manager"] != 0) {
$autoValue = User::model()->fetchRealnameByUid($deptCache[$dept]["manager"]);
}
break;
default:
break;
}
if ($value == "" && !$readOnly || $this->flow->isFixed() && $readOnly && StringUtil::findIn($this->process->processitemauto, $item["data-title"]) && $this->rp->opflag) {
$eleout = "\t\t\t\t<input type=\"text\" style=\"width:{$width} px;\" name=\"data_{$item["itemid"]}\" value=\"{$autoValue}\" title=\"{$item["data-title"]}\" />";
} else {
$eleout = "\t\t\t\t<input type=\"text\" style=\"width:{$width} px;\" name=\"data_{$item["itemid"]}\" value=\"{$value}\" title=\"{$item["data-title"]}\" />";
}
$hidden = isset($item["data-hide"]) ? $item["data-hide"] : "0";
if ($hidden == "1") {
$eleout = str_ireplace("type=\"text\"", "type=\"hidden\"", $eleout);
}
if (!$readOnly) {
if ($this->inApp && $this->flow->isFixed() && StringUtil::findIn($this->process->processitemauto, $item["data-title"])) {
$readOnly = true;
} else {
$eleout = str_ireplace("<input", "<input data-orig-value=\"{$autoValue}\" data-focus=\"restore\"", $eleout);
}
}
if ($readOnly) {
$this->setCommonReadOnly($item, $eleout, "input");
}
} else {
$autoValue = "<option value=\"\"";
if ($value == "") {
$autoValue .= " selected";
}
$autoValue .= "></option>\n";
switch ($field) {
case "sys_list_dept":
$cache = DepartmentUtil::loadDepartment();
$str = StringUtil::getTree($cache, "<option value='\$deptid' \$selected>\$spacer\$deptname</option>", $value);
$autoValue .= $str;
break;
case "sys_list_user":
foreach (UserUtil::loadUser() as $user) {
$selected = $value == $user["uid"] ? "selected" : "";
$autoValue .= "<option {$selected} value='" . $user["uid"] . "'>" . $user["realname"] . "</option>";
}
break;
case "sys_list_pos":
foreach (PositionUtil::loadPosition() as $pos) {
$selected = $value == $pos["positionid"] ? "selected" : "";
$autoValue .= "<option {$selected} value='" . $pos["positionid"] . "'>" . $pos["posname"] . "</option>";
}
break;
case "sys_list_prcsuser1":
$autoValue .= $this->getProcessUserList($this->flow->flowid, 0, $value);
break;
case "sys_list_prcsuser2":
$autoValue .= $this->getProcessUserList($this->flow->flowid, $this->process->processid, $value, true);
break;
case "sys_list_sql":
$sql = $item["data-src"];
$tempopt = array("uid" => Ibos::app()->user->uid, "deptid" => Ibos::app()->user->deptid, "positionid" => Ibos::app()->user->positionid, "runid" => $this->inDebug ? "" : $this->run->runid);
$autoValue = $this->execSysSql($sql, $tempopt);
$autoValue .= $this->arrayTolist($autoValue, $value);
break;
case "sys_list_manager1":
$main = Ibos::app()->user->deptid;
$autoValue .= $this->getManagerList($main, $value);
break;
case "sys_list_manager2":
$main = Ibos::app()->user->deptid;
$deptCache = DepartmentUtil::loadDepartment();
$upid = $deptCache[$main]["upid"];
if ($upid != 0) {
$autoValue .= $this->getManagerList($main, $value);
}
break;
case "sys_list_manager3":
$main = Ibos::app()->user->deptid;
$deptCache = DepartmentUtil::loadDepartment();
$dept_str = Department::model()->queryDept($main);
$temp = explode(",", $dept_str);
$count = count($temp);
$dept = $temp[$count - 2];
$autoValue .= $this->getManagerList($dept, $value);
break;
}
$eleout = "\t\t\t\t\t<select title=\"{$item["data-title"]}\" name=\"data_{$item["itemid"]}\">\r\n\t\t\t\t\t{$autoValue}\r\n\t\t\t\t\t</select>";
if ($readOnly) {
$this->setCommonReadOnly($item, $eleout, "select");
}
}
return $eleout;
}
示例7: actionEdit
public function actionEdit()
{
$id = EnvUtil::getRequest("id");
if (EnvUtil::submitCheck("posSubmit")) {
if (isset($_POST["posname"])) {
$data["posname"] = $_POST["posname"];
$data["sort"] = $_POST["sort"];
$data["catid"] = intval(EnvUtil::getRequest("catid"));
$data["goal"] = $_POST["goal"];
$data["minrequirement"] = $_POST["minrequirement"];
Position::model()->modify($id, $data);
}
if (isset($_POST["responsibility"])) {
foreach ($_POST["responsibility"] as $rId => $value) {
$data = array("positionid" => $id, "responsibility" => $value, "criteria" => $_POST["criteria"][$rId]);
PositionResponsibility::model()->modify($rId, $data);
}
}
if (isset($_POST["newResponsibility"])) {
$this->addResponsibility($id, $_POST["newResponsibility"], $_POST["newCriteria"]);
}
if (!empty($_POST["resDelId"])) {
$delId = trim($_POST["resDelId"], ",");
PositionResponsibility::model()->deleteByPk(explode(",", $delId));
}
if (isset($_POST["nodes"])) {
$this->updateAuthItem($id, $_POST["nodes"], $_POST["data-privilege"]);
}
if (isset($_POST["member"])) {
UserUtil::setPosition($id, $_POST["member"]);
} else {
OrgUtil::update();
}
PositionUtil::cleanPurvCache($id);
$this->success(Ibos::lang("Save succeed", "message"), $this->createUrl("position/index"));
} else {
$pos = Position::model()->fetchByPk($id);
$related = NodeRelated::model()->fetchAllByPosId($id);
$relateCombine = PositionUtil::combineRelated($related);
$responsibility = PositionResponsibility::model()->fetchAllByPosId($id);
$data["id"] = $id;
$data["pos"] = $pos;
$catData = PositionUtil::loadPositionCategory();
$data["category"] = StringUtil::getTree($catData, $this->selectFormat, $pos["catid"]);
$data["related"] = $relateCombine;
$data["responsibility"] = $responsibility;
$authItem = AuthUtil::loadAuthItem();
$data["authItem"] = $authItem;
$uids = User::model()->fetchUidByPosId($id, false);
if (!empty($uids)) {
$data["uids"] = $uids;
$data["uidString"] = "";
foreach ($uids as $uid) {
$data["uidString"] .= "'u_" . $uid . "',";
}
$data["uidString"] = trim($data["uidString"], ",");
}
$this->setPageTitle(Ibos::lang("Edit position"));
$this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Organization"), "url" => $this->createUrl("department/index")), array("name" => Ibos::lang("Position manager"), "url" => $this->createUrl("position/index")), array("name" => Ibos::lang("Edit position"))));
$this->render("edit", $data);
}
}
示例8: companyInit
private function companyInit()
{
if (Ibos::app()->request->isAjaxRequest) {
$postData = array();
$keys = array("phone", "fullname", "shortname", "fax", "zipcode", "address", "adminemail", "systemurl");
foreach ($keys as $key) {
if (isset($_POST[$key])) {
$postData[$key] = StringUtil::filterCleanHtml($_POST[$key]);
} else {
$postData[$key] = "";
}
}
Setting::model()->updateSettingValueByKey("unit", $postData);
CacheUtil::update(array("setting"));
$depts = EnvUtil::getRequest("depts");
$isSuccess = $this->handleDept($depts);
if ($isSuccess) {
$uid = Ibos::app()->user->uid;
User::model()->modify($uid, array("newcomer" => 0));
$deptCache = Ibos::app()->setting->get("cache/department");
$posCache = Ibos::app()->setting->get("cache/position");
$selectFormat = "<option value='\$deptid' \$selected>\$spacer\$deptname</option>";
$res["isSuccess"] = true;
$res["depts"] = StringUtil::getTree($deptCache, $selectFormat);
$res["positions"] = $posCache;
} else {
$res["isSuccess"] = false;
$res["msg"] = Ibos::lang("Add department fail");
}
$this->ajaxReturn($res);
}
}