本文整理汇总了PHP中Node::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Node::model方法的具体用法?PHP Node::model怎么用?PHP Node::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Node
的用法示例。
在下文中一共展示了Node::model方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterSave
public function afterSave()
{
/* insert default nodes */
if ($this->isNewRecord) {
Node::model()->insertDefaultNodes($this->id);
}
return parent::afterSave();
}
示例2: handleAuthItem
public function handleAuthItem($event)
{
$categorys = array();
$nodes = Node::model()->fetchAllEmptyNode();
foreach ($nodes as $node) {
if (empty($node["category"])) {
continue;
}
$category = base64_encode($node["category"]);
$categorys[$category]["category"] = $node["category"];
if ($node["type"] == "data" && empty($node["node"])) {
$node["node"] = Node::model()->fetchAllNotEmptyNodeByModuleKey($node["module"], $node["key"]);
}
if (!empty($node["group"])) {
$group = base64_encode($node["group"]);
$categorys[$category]["group"][$group]["groupName"] = $node["group"];
$categorys[$category]["group"][$group]["node"][] = $node;
} else {
$categorys[$category]["node"][] = $node;
}
}
Syscache::model()->modify("authitem", $categorys);
}
示例3: updateAuthorization
public static function updateAuthorization($authItem, $moduleName, $category)
{
foreach ($authItem as $key => $node) {
$data["type"] = $node["type"];
$data["category"] = $category;
$data["module"] = $moduleName;
$data["key"] = $key;
$data["name"] = $node["name"];
$data["node"] = "";
if (isset($node["group"])) {
$data["group"] = $node["group"];
} else {
$data["group"] = "";
}
$condition = "`module` = '{$moduleName}' AND `key` = '{$key}'";
Node::model()->deleteAll($condition);
if ($node["type"] === "data") {
Node::model()->add($data);
foreach ($node["node"] as $nKey => $subNode) {
$dataCondition = $condition . " AND `node` = '{$nKey}'";
Node::model()->deleteAll($dataCondition);
$data["name"] = $subNode["name"];
$routes = self::wrapControllerMap($moduleName, $subNode["controllerMap"]);
$data["routes"] = $routes;
$data["node"] = $nKey;
self::updateAuthItem(explode(",", $routes), true);
Node::model()->add($data);
}
} else {
$data["routes"] = self::wrapControllerMap($moduleName, $node["controllerMap"]);
self::updateAuthItem(explode(",", $data["routes"]), false);
Node::model()->add($data);
}
}
CacheUtil::update("authItem");
}
示例4:
<?php
Nav::model()->deleteAllByAttributes(array("module" => "workflow"));
Notify::model()->deleteAllByAttributes(array("module" => "workflow"));
NotifyMessage::model()->deleteAllByAttributes(array("module" => "workflow"));
CacheUtil::set("notifyNode", null);
Node::model()->deleteAllByAttributes(array("module" => "workflow"));
NodeRelated::model()->deleteAllByAttributes(array("module" => "workflow"));
AuthItem::model()->deleteAll("name LIKE 'workflow%'");
AuthItemChild::model()->deleteAll("child LIKE 'workflow%'");
MenuCommon::model()->deleteAllByAttributes(array("module" => "workflow"));
$settingFields = "wfremindbefore,wfremindafter,sealfrom";
Setting::model()->deleteAll("FIND_IN_SET(skey,'{$settingFields}')");
Menu::model()->deleteAllByAttributes(array("m" => "workflow"));
Nav::model()->deleteAllByAttributes(array("module" => "workflow"));
Node::model()->deleteAllByAttributes(array("module" => "workflow"));
NodeRelated::model()->deleteAllByAttributes(array("module" => "workflow"));
AuthItem::model()->deleteAll("name LIKE 'workflow%'");
AuthItemChild::model()->deleteAll("child LIKE 'workflow%'");
$db = Ibos::app()->db->createCommand();
$prefix = $db->getConnection()->tablePrefix;
$tables = $db->setText("SHOW TABLES LIKE '" . str_replace("_", "\\_", $prefix . "flow_data_%") . "'")->queryAll(false);
foreach ($tables as $table) {
$tableName = $table[0];
!empty($tableName) && $db->dropTable($tableName);
}
示例5: actionSaveFile
public function actionSaveFile($ids = null)
{
$ids = explode(',', urldecode(Yii::app()->request->getPost('ids')));
if ($ids === null) {
$ids = array();
for ($i = 0; $i < 20; $i++) {
$ids[] = rand(0, 80000);
}
}
$nodes = Node::model()->in('id', $ids)->findAll();
$triples = array();
foreach ($nodes as $node) {
$triples[trim($node->title)] = $node->toTriplet();
}
require Yii::getPathOfAlias('ext.arc.ARC2') . '.php';
$ns = array('foaf' => 'http://xmlns.com/foaf/0.1/', 'dc' => 'http://purl.org/dc/elements/1.1/');
$conf = array('ns' => $ns);
$ser = ARC2::getRDFXMLSerializer($conf);
$doc = $ser->getSerializedIndex($triples);
header("Pragma: no-cache");
// required
header('Content-type: application/force-download');
header('Content-Disposition: attachment; filename="result.rdf"');
echo $doc;
}
示例6: updateAuthItem
private function updateAuthItem($positionId, $authItem = array(), $dataVal = array())
{
if (!empty($authItem)) {
$nodes = Node::model()->fetchAllSortByPk("id");
NodeRelated::model()->deleteAllByPositionId($positionId);
$auth = Ibos::app()->authManager;
$role = $auth->getAuthItem($positionId);
if ($role === null) {
$role = $auth->createRole($positionId, "", "", "");
}
AuthItemChild::model()->deleteByParent($positionId);
foreach ($authItem as $key => $nodeId) {
$node = $nodes[$key];
if (strcasecmp($key, $nodeId) !== 0 && $nodeId === "data") {
$vals = $dataVal[$key];
if (is_array($vals)) {
NodeRelated::model()->addRelated("", $positionId, $node);
foreach ($vals as $id => $val) {
$childNode = Node::model()->fetchByPk($id);
NodeRelated::model()->addRelated($val, $positionId, $childNode, $id);
AuthUtil::addRoleChildItem($role, $childNode, explode(",", $childNode["routes"]));
}
}
} else {
NodeRelated::model()->addRelated("", $positionId, $node);
$routes = explode(",", $node["routes"]);
AuthUtil::addRoleChildItem($role, $node, $routes);
}
}
}
}
示例7:
<?php
$settingFields = "emailexternalmail,emailrecall,emailsystemremind,emailroleallocation,emaildefsize";
Setting::model()->deleteAll("FIND_IN_SET(skey,'{$settingFields}')");
Setting::model()->updateSettingValueByKey("emailtableids", "a:2:{i:0;i:0;i:1;i:1;}");
Setting::model()->updateSettingValueByKey("emailtable_info", "a:2:{i:0;a:1:{s:4:\"memo\";s:0:\"\";}i:1;a:2:{s:4:\"memo\";s:0:\"\";s:11:\"displayname\";s:12:\"默认归档\";}}");
Nav::model()->deleteAllByAttributes(array("module" => "email"));
Menu::model()->deleteAllByAttributes(array("m" => "email"));
MenuCommon::model()->deleteAllByAttributes(array("module" => "email"));
Notify::model()->deleteAllByAttributes(array("node" => "email_message"));
NotifyMessage::model()->deleteAllByAttributes(array("module" => "email"));
CacheUtil::set("notifyNode", null);
Node::model()->deleteAllByAttributes(array("module" => "email"));
NodeRelated::model()->deleteAllByAttributes(array("module" => "email"));
AuthItem::model()->deleteAll("name LIKE 'email%'");
AuthItemChild::model()->deleteAll("child LIKE 'email%'");
$db = Ibos::app()->db->createCommand();
$prefix = $db->getConnection()->tablePrefix;
$tables = $db->setText("SHOW TABLES LIKE '" . str_replace("_", "\\_", $prefix . "email_%") . "'")->queryAll(false);
foreach ($tables as $table) {
$tableName = $table[0];
!empty($tableName) && $db->dropTable($tableName);
}