本文整理汇总了PHP中CRUD::dataFetch方法的典型用法代码示例。如果您正苦于以下问题:PHP CRUD::dataFetch方法的具体用法?PHP CRUD::dataFetch怎么用?PHP CRUD::dataFetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRUD
的用法示例。
在下文中一共展示了CRUD::dataFetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: row
private static function row()
{
$rsnum = CRUD::dataFetch('feedback', false, false, array('createdate' => 'desc'), false, true);
if (!empty($rsnum)) {
VIEW::newBlock("TAG_FEEDBACK_BLOCK");
$data = CRUD::$data;
foreach ($data as $key => $row) {
VIEW::newBlock("TAG_FEEDBACK_LIST");
foreach ($row as $field => $var) {
switch ($field) {
case "gender":
$gender = $var ? self::$lang['male'] : self::$lang['female'];
$var = $gender;
break;
case "status":
$status = $var ? self::$lang["status_on"] : self::$lang["status_off"];
if (empty($var)) {
VIEW::assign("CLASS_STATUS_RED", 'red');
}
$var = $status;
break;
}
VIEW::assign("VALUE_" . strtoupper($field), $var);
}
VIEW::assign('VALUE_NUMBER', PAGE::$start + ++$i);
}
} else {
VIEW::newBlock("TAG_NONE");
}
}
示例2: form
private static function form($m_id = false)
{
if (!empty($m_id)) {
CRUD::dataFetch('member', array('id' => $m_id));
list($row) = CRUD::$data;
foreach ($row as $field => $var) {
switch ($field) {
case "gender":
$field = $field . '_CK' . $var;
$var = 'selected';
break;
}
$output['VALUE_' . strtoupper($field)] = $var;
}
}
$output['VALUE_SUBJECT_OPTION'] = self::subjectOption($row['subject']);
VIEW::assignGlobal($output);
CRUD::args_output(true, true);
SEO::load('contact');
if (empty(SEO::$data["h1"])) {
SEO::$data["h1"] = CORE::$lang["contact"];
}
SEO::output();
CRUMBS::fetch('contact');
}
示例3: row
public static function row()
{
$args = !self::$cate ? array('status' => '1') : array('status' => '1', 'id' => self::$cate);
$rsnum = CRUD::dataFetch('ad_cate', $args);
if (!empty($rsnum)) {
$dataRow = CRUD::$data;
$nowDate = date("Y-m-d");
foreach ($dataRow as $key => $cate) {
$rsnum = CRUD::dataFetch('ad', array('langtag' => CORE::$langtag, 'parent' => $cate["id"], 'custom' => "status = '1' or (status = '2' and startdate <= '{$nowDate}' and limitdate >= '{$nowDate}')"));
if (!empty($rsnum)) {
VIEW::newBlock("TAG_AD_BLOCK" . $cate["id"]);
foreach (CRUD::$data as $key => $row) {
VIEW::newBlock("TAG_AD_LIST" . $cate["id"]);
foreach ($row as $field => $var) {
switch ($field) {
case "link":
if (empty($var)) {
$var = '#';
}
default:
VIEW::assign("VALUE_" . strtoupper($field), $var);
break;
}
}
IMAGES::load('ad', $row["id"]);
list($images) = IMAGES::$data;
VIEW::assign(array("VALUE_IMAGE" => $images["path"], "VALUE_ALT" => $images["alt"], "VALUE_TITLE" => $images["title"]));
}
}
}
}
}
示例4: auto
public static function auto($tb_name, $langtag, $id, $sort = 1)
{
$rsnum = CRUD::dataFetch($tb_name, array('id' => $id));
if (empty($rsnum)) {
return false;
}
list($selfRow) = CRUD::$data;
$addon = '';
if (isset($selfRow["parent"])) {
$addon .= !empty($selfRow["parent"]) ? " and parent = '{$selfRow["parent"]}'" : " and parent IS NULL";
}
if (!empty($selfRow['lang_id']) && !empty($selfRow['langtag'])) {
$addon .= " and langtag = '{$langtag}'";
}
$rsnum = CRUD::dataFetch($tb_name, array('custom' => "id != '{$id}' {$addon}"), false, array('sort' => CORE::$cfg["sort"]));
if (!empty($rsnum)) {
$dataRow = CRUD::$data;
foreach ($dataRow as $key => $row) {
# 讓出預定排序位置
$autoSort = ++$i == $sort ? ++$i : $i;
$sort_args[] = array('id' => $row["id"], 'sort' => $autoSort);
}
}
$sort_args[] = array('id' => $id, 'sort' => $sort);
# 重置所有相關資料排序
if (is_array($sort_args)) {
foreach ($sort_args as $args) {
DB::update(CORE::$prefix . "_" . $tb_name, array('sort' => $args["sort"], 'id' => $args["id"]));
}
}
}
示例5: subjectFetch
protected static function subjectFetch($id, $field = '*')
{
$rsnum = CRUD::dataFetch('contact_subject', array('id' => $id), array($field));
if (!empty($rsnum)) {
list($row) = CRUD::$data;
return $row[$field];
}
return false;
}
示例6: fetch
public static function fetch($id)
{
$rsnum = CRUD::dataFetch('stock_bind', array('id' => $id));
if (!empty($rsnum)) {
return CRUD::$data[0];
} else {
return false;
}
}
示例7: news
private static function news()
{
self::$rsnum[] = $rsnum = CRUD::dataFetch('news', array('langtag' => CORE::$langtag, 'status' => '1', 'custom' => "(subject like '%" . self::$kw . "%' or content like '%" . self::$kw . "%')"));
if (!empty($rsnum)) {
$dataRow = CRUD::$data;
foreach ($dataRow as $key => $row) {
VIEW::newBlock("TAG_SEARCH_LIST");
VIEW::assign(array("VALUE_SUBJECT" => $row["subject"], "VALUE_CONTENT" => mb_substr(strip_tags($row["content"]), 0, 50, 'UTF-8'), "VALUE_LINK" => NEWS::dataLink($row["parent"], $row)));
}
}
}
示例8: nav
private static function nav()
{
VIEW::assignGlobal("NAV_CATE_TITLE", 'ABOUT');
$rsnum = CRUD::dataFetch('intro', array('status' => '1', 'langtag' => CORE::$langtag), false, array('sort' => CORE::$cfg["sort"]));
if (!empty($rsnum)) {
$dataRow = CRUD::$data;
foreach ($dataRow as $key => $row) {
VIEW::newBlock("TAG_NAV_LIST");
VIEW::assign(array("VALUE_NAV_SUBJECT" => $row["subject"], "VALUE_NAV_LINK" => CORE::$root . 'intro/' . SEO::link($row) . '/', "VALUE_NAV_CURRENT" => empty(self::$id) && ++$i == 1 || self::$id == $row["id"] ? 'active' : ''));
}
}
}
示例9: idx_row
public static function idx_row()
{
$rsnum = CRUD::dataFetch('news', array('status' => '1', 'langtag' => CORE::$langtag), false, array('sort' => CORE::$cfg["sort"]), '0,4');
if (!empty($rsnum)) {
foreach (CRUD::$data as $key => $row) {
VIEW::newBlock("IDX_NEWS_LIST");
foreach ($row as $field => $var) {
switch ($field) {
case "showdate":
VIEW::assign("VALUE_" . strtoupper($field), date("Y.m.d", strtotime($var)));
break;
default:
VIEW::assign("VALUE_" . strtoupper($field), $var);
break;
}
}
VIEW::assign("VALUE_LINK", self::dataLink($row["parent"], $row));
}
}
}
示例10: replace
private static function replace()
{
CHECK::is_email($_POST["email"]);
CHECK::is_must($_POST["callback"]);
if (CHECK::is_pass()) {
$systemExist = CRUD::dataFetch('system', array('id' => '1'));
$args = array_merge($_POST, array('id' => '1'));
if ($systemExist) {
CRUD::dataUpdate('system', $args);
} else {
CRUD::dataInsert('system', $args);
}
if (!empty(DB::$error)) {
$msg = array(DB::$error, CORE::$manage . 'system/');
} else {
$msg = array(self::$lang["modify_done"], CORE::$manage . 'system/');
}
} else {
$msg = array(CHECK::$alert, CORE::$manage . 'system/');
}
CORE::msg($msg);
}
示例11: detail
private static function detail()
{
$serial = array_shift(CORE::$args);
$o_row = self::row($serial);
if (is_array(self::$lang["order_status"])) {
foreach (self::$lang["order_status"] as $status => $status_str) {
VIEW::newBlock("TAG_STATUS_LIST");
VIEW::assign(array("VALUE_STATUS_STR" => $status_str, "VALUE_STATUS" => $status, "VALUE_STATUS_CK" => $status == $o_row["status"] ? 'checked' : ''));
}
}
$rsnum = CRUD::dataFetch('order_item', array('serial' => $serial), false, array('id' => 'desc'));
if (!empty($rsnum)) {
VIEW::newBlock("TAG_ITEM_BLOCK");
foreach (CRUD::$data as $key => $row) {
VIEW::newBlock("TAG_ITEM_LIST");
foreach ($row as $field => $var) {
VIEW::assign("VALUE_" . strtoupper($field), $var);
}
VIEW::assign("VALUE_ROW", ++$i);
}
}
}
示例12: setting
public static function setting()
{
$rsnum = CRUD::dataFetch('system', array('id' => '1'));
if (!empty($rsnum)) {
self::$setting = CRUD::$data[0];
foreach (self::$setting as $field => $var) {
switch ($field) {
case "address":
if (!empty($var)) {
$output['SYSTEM_MAP'] = 'https://maps.google.com.tw/maps?f=q&hl=zh-TW&geocode&q=' . $var;
}
break;
case "ga":
$var = self::gaLoad($var);
break;
case "email":
if (empty($var)) {
# 如果未設定系統 E-mail,設定初始 E-mail
$var = 'potsonhumer@gmail.com';
self::$setting[$field] = $var;
}
break;
case "facebook":
case "gplus":
case "twitter":
case "instagram":
case "linkedin":
$output['SYSTEM_' . strtoupper($field) . '_TARGET'] = !empty($var) ? '_blank' : '_self';
$var = empty($var) ? '#' : $var;
break;
}
$output['SYSTEM_' . strtoupper($field)] = $var;
}
VIEW::assignGlobal($output);
}
}
示例13: reset_password
private static function reset_password($id)
{
CRUD::dataFetch('member', array('id' => $id));
list($row) = CRUD::$data;
$rand_password = CORE::rand_password();
$forget_temp = 'ogs-mail-forget-tpl.html';
CRUD::dataUpdate('member', array('password' => md5($rand_password), 'id' => $row["id"]));
CORE::msg(self::$lang["forget_send"], CORE::$manage . 'member/detail/' . $row["id"] . '/');
# 原本樣板
new VIEW(self::$temp_option["HULL"], self::$temp, true, 1);
$origin_output = VIEW::$output;
# 輸出取回密碼樣板
VIEW::assignGlobal('VALUE_RAND_PASSWORD', $rand_password);
new VIEW($forget_temp, false, true, false);
CORE::mail_handle(SYSTEM::$setting["email"], $row["email"], VIEW::$output, self::$lang["forget_recall"], SYSTEM::$setting["name"]);
# 寄出認證信
exit;
}
示例14: detail
private static function detail()
{
$rsnum = CRUD::dataFetch('products', array('id' => self::$id));
if (!empty($rsnum)) {
list($row) = CRUD::$data;
foreach ($row as $field => $var) {
VIEW::assignGlobal("VALUE_" . strtoupper($field), $var);
}
SCHEMA::make('products_detail', $row);
VIEW::assignGlobal("VALUE_BACK_LINK", self::dataLink(self::$cate));
IMAGES::load('products', $row["id"]);
foreach (IMAGES::$data as $key => $images) {
switch ($key) {
case 0:
break;
case 1:
foreach ($images as $field => $var) {
VIEW::assignGlobal("IMAGE_" . strtoupper($field), $var);
}
default:
VIEW::newBlock("TAG_IMAGES");
foreach ($images as $field => $var) {
VIEW::assign("IMAGES_" . strtoupper($field), $var);
}
break;
}
}
if (empty($row["discount"])) {
VIEW::assignGlobal("DISCOUNT_NONE", 'style="display: none;"');
}
SEO::load($row["seo_id"]);
if (empty(SEO::$data["h1"])) {
SEO::$data["h1"] = $row["subject"];
}
SEO::output();
CRUMBS::fetch('products', $row);
while (++$i <= 99) {
VIEW::newBlock("TAG_AMOUNT_LIST");
VIEW::assign("VALUE_AMOUNT", $i);
}
PRODUCTS::related($row['related']);
}
}
示例15: seek
private static function seek($id = false)
{
if (empty($_POST['call'])) {
echo 'NONE';
}
$seekStr = $_POST['call'];
if (!empty($id)) {
$rsnum = CRUD::dataFetch('gallery', array('id' => $id), array('related'));
if (!empty($rsnum)) {
list($nowRow) = CRUD::$data;
if (!empty($nowRow['related'])) {
$relatedArray = json_decode($nowRow['related'], true);
$seekFilter = "id NOT IN('" . implode("','", $relatedArray) . "','" . $id . "')";
$sk = array('status' => '1', 'langtag' => CORE::$langtag, 'subject' => '%' . $seekStr . '%', 'custom' => $seekFilter);
} else {
$sk = array('status' => '1', 'langtag' => CORE::$langtag, 'subject' => '%' . $seekStr . '%', 'id' => "!{$id}");
}
}
}
if (empty($sk) || !is_array($sk)) {
$sk = array('status' => '1', 'langtag' => CORE::$langtag, 'subject' => '%' . $seekStr . '%');
}
$rsnum = CRUD::dataFetch('gallery', $sk);
if (!empty($rsnum)) {
$dataRow = CRUD::$data;
foreach ($dataRow as $key => $row) {
foreach ($row as $field => $var) {
$output[$key][$field] = rawurlencode($var);
}
IMAGES::load('gallery', $row["id"]);
list($image) = IMAGES::$data;
$output[$key]['image'] = '<img src="' . $image['path'] . '" style="width: 100px;">';
$output[$key]['link'] = GALLERY::dataLink($row['parent'], $row);
}
if (is_array($output)) {
echo json_encode($output);
}
} else {
echo 'NONE';
}
}