本文整理汇总了PHP中model::search方法的典型用法代码示例。如果您正苦于以下问题:PHP model::search方法的具体用法?PHP model::search怎么用?PHP model::search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model
的用法示例。
在下文中一共展示了model::search方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: arg
include_once "lib/http_service.php";
include_once "lib/model_json.php";
damas_service::init_http();
damas_service::accessGranted();
damas_service::allowed("model::" . arg("cmd"));
if (!arg("cmd")) {
header("HTTP/1.1: 400 Bad Request");
echo "Bad command";
exit;
}
header('Content-type: application/json');
$ret = false;
switch (arg("cmd")) {
/* SCRUD operations */
case "search":
echo json_encode(model::search(json_decode(arg("keys")), arg("sortby"), arg("order"), arg("limit")));
break;
case "create":
if (is_null(arg('keys'))) {
header("HTTP/1.1: 400 Bad Request");
echo "Bad command";
exit;
}
$id = model::create(json_decode(arg("keys")));
if (!$id) {
header("HTTP/1.1: 409 Conflict");
echo "create Error, please change your values";
exit;
}
echo json_encode(model_json::node($id, 1, $NODE_TAG | $NODE_PRM));
break;
示例2: children
/**
* Retrieve the children of a node
* @param {Integer} $id node index
* @return {Array} array of children ids
*/
static function children($id)
{
$res = array();
// PROTOTYPE BEGIN
$protoname = model::getKey($id, 'prototype');
if ($protoname) {
$proto = model::searchKey('id', $protoname);
$proto = $proto[0];
if ($proto) {
$res = model::children($proto);
}
}
// PROTOTYPE END
return $res + model::search(array('#parent' => '= ' . $id));
}
示例3: header
echo $msg . '. No change made.';
exit;
}
if (!is_uploaded_file($file['tmp_name'])) {
header("HTTP/1.1: 409 Conflict");
echo $file['name'] . ": is_uploaded_file returned false. Possible break attempt. No change made.";
exit;
}
$dir = '';
$path = '';
$id = '';
if (model::getKey(arg('id'), 'dir')) {
// we are in a dir
$dir = model::getKey(arg('id'), 'dir');
$path = $dir . '/' . $file['name'];
$id = array_shift(model::search(array('file' => "='" . $path . "'")));
} else {
$path = model::getKey(arg('id'), 'file');
$dir = dirname($path);
$id = arg('id');
}
$error_detected = false;
if (!is_writable($assetsLCL . $dir)) {
$error_detected = true;
$msg .= $dir . " is not writable. ";
}
if ($id) {
// replacement checks
switch (model::getKey($id, 'mode')) {
case '1':
default: