本文整理汇总了PHP中DBObject::collection方法的典型用法代码示例。如果您正苦于以下问题:PHP DBObject::collection方法的具体用法?PHP DBObject::collection怎么用?PHP DBObject::collection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBObject
的用法示例。
在下文中一共展示了DBObject::collection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute()
{
$return = new stdClass();
$params = Request::_REQUEST();
Config::set("HideDebugger", true);
$users = DBObject::collection("Member", DBObject::CONSISTENCY_ABSOLUTE);
$fullCount = $users->getMemberCount();
$users = DBObject::collection("Member", DBObject::CONSISTENCY_ABSOLUTE);
$users->setRange($params["iDisplayStart"], $params["iDisplayLength"]);
switch ($params["iSortCol_0"]) {
case 0:
$users->applySort("AutoID", $params["sSortDir_0"]);
break;
case 1:
$users->applySort("userFirstname", $params["sSortDir_0"]);
break;
case 2:
$users->applySort("userLastname", $params["sSortDir_0"]);
break;
case 3:
$users->applySort("useremail", $params["sSortDir_0"]);
break;
case 4:
$users->applySort("level", $params["sSortDir_0"]);
break;
case 5:
$users->applySort("is_enabled", $params["sSortDir_0"]);
break;
}
$return = array("sEcho" => $params["sEcho"], "iTotalRecords" => $fullCount, "iTotalDisplayRecords" => $fullCount, "aaData" => array());
foreach ($users->getMembers() as $_user) {
$row = array();
$row[] = $_user->getID();
$row[] = $_user->getUserFirstname();
$row[] = $_user->getUserLastname();
$row[] = $_user->getUserEmail();
$row[] = $_user->getLevel();
$row[] = $_user->getIsEnabled();
$row[] = $_user->getLastLogin();
$row[] = "<a onclick=\"editUser(this, '" . $_user->getID() . "');\"><span class=\"ui-icon ui-icon-wrench\"></span></a><a onclick=\"deleteUser(this, '" . $_user->getID() . "');\"><span class=\"ui-icon ui-icon-trash\"></span></a>";
$return["aaData"][] = $row;
}
echo json_encode($return);
return;
}
示例2: activate
public function activate()
{
$this->setPageData('header/title', 'Users');
$this->setPageView('admin/AdminPage');
$this->setBodyView('admin/body/Users');
$this->addPageData('header/meta', array('description' => 'Passing Green :: Administration :: Users'));
$this->addPageData('header/assets/js', array('/admin-new/js/user.js'));
$business_categories = DBObject::collection('BusinessCategory', DBObject::CONSISTENCY_ABSOLUTE);
$business_categories->applySort("category");
$countries = DBObject::collection('Country', DBObject::CONSISTENCY_ABSOLUTE);
$countries->applySort("country");
$provinces = DBObject::collection('Province', DBObject::CONSISTENCY_ABSOLUTE);
$provinces->applySort("name");
$this->addPageData('body/UserEditForm/business_categories', $business_categories->getBusinessCategories());
$this->addPageData('body/UserEditForm/countries', $countries->getCountries());
$this->addPageData('body/UserEditForm/provinces', $provinces->getProvinces());
$this->loadPage();
}
示例3: execute
function execute()
{
$return = new stdClass();
$params = Request::_REQUEST();
Config::set("HideDebugger", true);
//comment this out to debug
if (isset($params["id"])) {
$user = new Member($params["id"]);
if (isset($user) && $user->isValid()) {
// retrieve account balance based on transactions
$user_balance = 0.0;
$user_commission = 0.0;
/* $Referral_Join = DBObject::collection("Referral");
$Member_Join = DBObject::collection("Member");
$Member_Vendor_Join = DBObject::collection("Member");
$Transactions = DBObject::collection("Transaction")
->applyJoin("LEFT OUTER", $Referral_Join, array("ReferralID", "AutoID"))
->applyJoin("LEFT OUTER", $Member_Join, array("UserID", "AutoID"))
->applyJoin("LEFT OUTER", $Member_Vendor_Join, array("VendorID", "AutoID"))
->applyUserIDFilter($user->getID());
Debugger::log(Var_Dump::display($Transactions->getTransactions(), true));
*/
$q = "SELECT\n\t\t\t\tt.`amount`,\n\t\t\t\tr.*,\n\t\t\t\tCONCAT(user.`userFirstname`, CONCAT(' ',user.`userLastname`)) as _from,\n\t\t\t\tCONCAT(vendor.`userFirstname`, CONCAT(' ',vendor.`userLastname`)) as _to\n\t\t\tFROM `transactions` t\n\n\t\t\tLEFT OUTER JOIN `referrals` r\n\t\t\t\tON (t.`ReferralID` = r.`AutoID`)\n\n\t\t\tLEFT OUTER JOIN `user_signup` user\n\t\t\t\tON (r.`UserID` = user.`AutoID`)\n\n\t\t\tLEFT OUTER JOIN `user_signup` vendor\n\t\t\t\tON (r.`VendorID` = vendor.`AutoID`)\n\n\t\t\tWHERE t.`UserID` ='" . $user->getID() . "'";
$user_transactions = DatabaseFactory::passinggreen_db()->query($q);
Debugger::log(Var_Dump::display($user_transactions, true));
while ($user_transactions_row = $user_transactions->fetch_object()) {
if ($user_transactions_row->UserID == $user->getID()) {
$user_balance += $user_transactions_row->amount;
//$referrals_passed[] = $row;
} else {
if ($user_transactions_row->VendorID == $user->getID()) {
$user_commission += $user_transactions_row->amount;
//$referrals_received[] = $row;
}
}
#else
#echo "PG.com +".$row->amount."<br>";
#echo "<pre>".print_r($row, true)."</pre>";
}
// referrals
$user_referrals_passed = DBObject::collection("Referral", DBObject::CONSISTENCY_ABSOLUTE)->applyUserIDFilter($user->getID())->getReferralCount();
$user_referrals_received = DBObject::collection("Referral", DBObject::CONSISTENCY_ABSOLUTE)->applyVendorIDFilter($user->getID())->getReferralCount();
Debugger::log("refs passed: {$user_referrals_passed}");
Debugger::log("refs recvd: {$user_referrals_received}");
// decrypt cc field if it is not empty
$user_crypt_key = CryptKey::findCryptKeyByUserID($user->getID());
if (isset($user_crypt_key) && $user_crypt_key->isValid()) {
Debugger::log("User crypt private key: " . $user_crypt_key->getKey());
$decoded_cc_data = unserialize(TwoWayEncryption::decrypt($user->getCC(), $user_crypt_key->getKey()));
} else {
$decoded_cc_data = null;
}
$return->id = $user->getID();
// object id
$return->user = $user->toArray();
// set the base return, values can be overridden below.
$return->user["userCompanyType[]"] = $user->getUserCompanyType();
$return->user["siteAreas[]"] = $user->getSiteAreas();
$return->user["passwd"] = null;
$return->user["balance"] = number_format($user_balance, 2);
if (!is_null($decoded_cc_data)) {
$return->user["ccc"] = $decoded_cc_data["details"];
$return->user["ccc_status"] = $decoded_cc_data["status"];
$return->user["ccc_tcode"] = $decoded_cc_data["tcode"];
$return->user["ccc_name"] = $decoded_cc_data["name"];
$return->user["ccc_ccNum"] = $decoded_cc_data["ccNum"];
$return->user["ccc_MM"] = $decoded_cc_data["MM"];
$return->user["ccc_YY"] = $decoded_cc_data["YY"];
$return->user["ccc_ccCode"] = $decoded_cc_data["ccCODE"];
}
$return->user["referralsPassed"] = $user_referrals_passed;
$return->user["referralsReceived"] = $user_referrals_received;
$return->user["accountBalance"] = number_format($user_balance, 2);
$return->user["commissionDue"] = number_format($user_commission, 2);
echo json_encode($return);
return;
} else {
$return->error = "ID is invalid.";
echo json_encode($return);
return;
}
} else {
$return->error = "Missing ID!";
echo json_encode($return);
return;
}
}