本文整理汇总了PHP中PdoDataAccess类的典型用法代码示例。如果您正苦于以下问题:PHP PdoDataAccess类的具体用法?PHP PdoDataAccess怎么用?PHP PdoDataAccess使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PdoDataAccess类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetTreeNodes
function GetTreeNodes()
{
$LetterID = $_REQUEST["LetterID"];
$creator = PdoDataAccess::runquery("\r\n\t\tselect PersonID,\r\n\t\t\tconcat_ws(' ',fname, lname,CompanyName) text, \r\n\t\t\t'true' as leaf, 'true' expanded,'user' iconCls,\r\n\t\t\tl.RegDate\r\n\t\tfrom OFC_letters l join BSC_persons p using(PersonID) where LetterID=?", array($LetterID));
$index = 1;
$returnArray = array();
$refArray = array();
$creator[0]["id"] = $index++;
$creator[0]["text"] .= " [ " . substr($creator[0]["RegDate"], 10, 6) . " " . DateModules::miladi_to_shamsi($creator[0]["RegDate"]) . "\t]";
$returnArray[] = $creator[0];
$refArray[$creator[0]["PersonID"]] =& $returnArray[count($returnArray) - 1];
$nodes = PdoDataAccess::runquery("\r\n\t\tselect FromPersonID ,ToPersonID, SendDate,\r\n\t\t\tconcat_ws(' ',fname, lname,CompanyName,' - ',InfoDesc) text, \r\n\t\t\tconcat('<b>توضیحات ارجاع : </b>' ,replace(SendComment,'\n','<br>')) qtip,\r\n\t\t\t'true' as leaf, 'true' expanded,'user' iconCls\r\n\t\tfrom OFC_send \r\n\t\t\tjoin BSC_persons p on(ToPersonID=PersonID) \r\n\t\t\tjoin BaseInfo bf on(bf.TypeID=12 AND SendType=InfoID)\r\n\t\twhere LetterID=?\r\n\t\torder by SendID", array($LetterID));
foreach ($nodes as $row) {
$row["id"] = $index++;
$row["text"] .= " [ " . substr($row["SendDate"], 10, 6) . " " . DateModules::miladi_to_shamsi($row["SendDate"]) . " ]";
$parentNode =& $refArray[$row["FromPersonID"]];
if (!isset($parentNode["children"])) {
$parentNode["children"] = array();
$parentNode["leaf"] = "false";
}
$lastIndex = count($parentNode["children"]);
$parentNode["children"][$lastIndex] = $row;
$refArray[$row["ToPersonID"]] =& $parentNode["children"][$lastIndex];
}
$str = json_encode($returnArray);
$str = str_replace('"children"', 'children', $str);
$str = str_replace('"leaf"', 'leaf', $str);
$str = str_replace('"iconCls"', 'iconCls', $str);
$str = str_replace('"text"', 'text', $str);
$str = str_replace('"id"', 'id', $str);
$str = str_replace('"true"', 'true', $str);
$str = str_replace('"false"', 'false', $str);
echo $str;
die;
}
示例2: SaveBase
function SaveBase()
{
$obj = new manage_bases();
PdoDataAccess::FillObjectByJsonData($obj, $_POST["record"]);
// بررسی گروه های تشویقی که بیشتر از 5 برای یک نفر نباشد
/*if(in_array($obj->BaseType, array(27,23,24,21,3,4,5)))
{
$query = "select sum(BaseValue) from bases
where PersonID=? AND
BaseType in(27,23,24,21,3,4,5) AND
BaseStatus = 'NORMAL'
";
$st = PdoDataAccess::runquery($query, array($obj->PersonID));
if(count($st) > 0 && (int)$st[0][0] + (int)$obj->BaseValue > 5)
{
echo Response::createObjectiveResponse(false, "OverMaxCGroup");
die();
}
}*/
//----------------------------
if (empty($obj->RowID)) {
$obj->RegDate = PDONOW;
$return = $obj->Add();
} else {
unset($obj->RegDate);
$return = $obj->Edit();
}
if (!$return) {
echo Response::createObjectiveResponse($return, ExceptionHandler::GetExceptionsToString());
die;
}
echo Response::createObjectiveResponse(true, "");
die;
}
示例3: changePass
function changePass()
{
require_once '../../../header.inc.php';
require_once inc_response;
require_once inc_dataReader;
$pdoAcc = PdoDataAccess::getPdoObject(config::$db_servers['master']["host"], config::$db_servers['master']["framework_user"], config::$db_servers['master']["framework_pass"], "framework");
$dt = PdoDataAccess::runquery("select * from AccountSpecs \n\t\t\t\t\t\t\t\t\t\twhere personID=:psid", array(":psid" => $_SESSION['PersonID']), $pdoAcc);
if (count($dt) == 0) {
echo "false";
die;
}
$password = md5($_POST["cur_pass"]);
$stored_seed = substr($dt[0]["pswd1"], 40, 10);
if (sha1($stored_seed . $password . $stored_seed) . $stored_seed != $dt[0]["pswd1"]) {
echo "CurPassError";
die;
}
$seed = '';
$password2 = md5($_POST["new_pass"]);
for ($i = 1; $i <= 10; $i++) {
$seed .= substr('0123456789abcdef', rand(0, 15), 1);
}
PdoDataAccess::RUNQUERY("update AccountSpecs set pswd1=:pswd where personID=:psid", array(":pswd" => sha1($seed . $password2 . $seed) . $seed, ":psid" => $_SESSION['PersonID']), $pdoAcc);
if (ExceptionHandler::GetExceptionCount() != 0) {
echo "CurPassError";
die;
}
//PdoDataAccess::AUDIT("AccountSpecs","تغییر رمز عبور", "");
echo "true";
die;
}
示例4: get_base
/**
* این تابع پایه استاد را بر می گرداند
* @param miladiDate $ToDate : اگر این پارامتر به تابع فرستاده شود تابع پایه استاد تا قبل این تاریخ را بر می گرداند
*/
static function get_base($PersonID, $ToDate = "")
{
$base = 1;
$education_level_rec = manage_person_education::GetEducationLevelByDate($PersonID, $ToDate);
if ($education_level_rec['university_id'] == 4) {
$base = 3;
}
if ($education_level_rec['max_education_level'] == EDUCATION_LEVEL_MS && $education_level_rec['burse'] == 1) {
$base += 1;
}
if ($education_level_rec['max_education_level'] == EDUCATION_LEVEL_PHD && $education_level_rec['burse'] == 1) {
$base += 3;
}
$query = "\r\n\t\t\tSELECT PersonID,\r\n\t\t personel_relation,\r\n\t\t devotion_type,\r\n\t\t sum(amount) sum_amount\r\n\t\t\r\n\t\t FROM \tperson_devotions\r\n\t\t\r\n\t\t WHERE PersonID = {$PersonID} AND\r\n\t\t personel_relation = 1 AND\r\n\t\t devotion_type = 4\r\n\t\t\r\n\t\t GROUP BY PersonID, personel_relation, devotion_type";
$temp = PdoDataAccess::runquery($query);
if (count($temp) != 0) {
$base += floor($temp[0]['sum_amount'] / 360);
}
$query = "\r\n\t\t\tSELECT PersonID,\r\n\t\t military_type\r\n\t\t FROM \tpersons\r\n\t\t WHERE PersonID = {$PersonID}";
$temp = PdoDataAccess::runquery($query);
if (count($temp) != 0 && $temp[0]['military_type'] == 12) {
$base += 1;
}
return $base;
}
示例5: saveStaffData
function saveStaffData()
{
$obj = new manage_staff();
PdoDataAccess::FillObjectByArray($obj, $_POST);
if (isset($_POST["work_start_date"])) {
$obj->work_start_date = DateModules::Shamsi_to_Miladi($_POST["work_start_date"]);
}
if (isset($_POST["ProfWorkStart"])) {
$obj->ProfWorkStart = DateModules::Shamsi_to_Miladi($_POST["ProfWorkStart"]);
}
if (isset($_POST["retired_date"])) {
$obj->retired_date = DateModules::Shamsi_to_Miladi($_POST["retired_date"]);
}
if (isset($_POST["last_retired_pay"])) {
$obj->last_retired_pay = DateModules::Shamsi_to_Miladi($_POST["last_retired_pay"]);
}
if (!isset($_POST['Over25'])) {
$obj->Over25 = 0;
}
$obj->sum_paied_pension = $obj->sum_paied_pension > 0 ? $obj->sum_paied_pension : "0";
$return = $obj->EditStaff();
$key = $obj->staff_id . "," . $obj->PersonID . "," . $obj->person_type;
echo $return ? Response::createObjectiveResponse("true", $key) : Response::createObjectiveResponse(false, ExceptionHandler::GetExceptionsToString("\n"));
die;
}
示例6: save
function save()
{
$obj = new manage_professor_exe_posts();
PdoDataAccess::FillObjectByArray($obj, $_POST);
$postObj = new manage_posts($obj->post_id);
if ($postObj->post_id == "") {
echo Response::createObjectiveResponse(false, "کد پست وارد شده معتبر نمی باشد.");
die;
}
if ($postObj->validity_start != "" && $postObj->validity_start != '0000-00-00' && DateModules::CompareDate($postObj->validity_start, str_replace("/", "-", DateModules::shamsi_to_miladi($obj->from_date))) > 0 || $postObj->validity_end != "" && $postObj->validity_end != '0000-00-00' && ($obj->to_date != "" && $obj->to_date != "0000-00-00") && DateModules::CompareDate($postObj->validity_end, str_replace("/", "-", DateModules::shamsi_to_miladi($obj->to_date))) < 0) {
echo Response::createObjectiveResponse(false, "پست انتخابی از نظر تاریخ اعتبار و تاریخ های شروع و پایان وارد شده معتبر نمی باشد.");
die;
}
if (empty($obj->row_no)) {
$return = $obj->ADD();
} else {
$return = $obj->Edit();
}
if (!$return) {
echo Response::createObjectiveResponse($return, ExceptionHandler::GetExceptionsToString());
die;
}
if (isset($_POST["assign_post"])) {
$return = $obj->assign_post();
} else {
$return = $obj->release_post();
}
echo Response::createObjectiveResponse($return, ExceptionHandler::GetExceptionsToString());
die;
}
示例7: removeTaxHistory
function removeTaxHistory()
{
$obj = new manage_staff_tax();
PdoDataAccess::FillObjectByJsonData($obj, $_POST["record"]);
echo $obj->Remove() ? "true" : "false";
die;
}
示例8: DatesAreValid
function DatesAreValid()
{
$dt = PdoDataAccess::runquery("select * from ATN_PersonShifts\r\n\t\t\twhere PersonID=:p \r\n\t\t\tAND ( :f between FromDate AND ToDate OR :t between FromDate AND ToDate ) AND RowID <> :r", array(":p" => $this->PersonID, ":r" => $this->RowID, ":f" => DateModules::shamsi_to_miladi($this->FromDate, "-"), ":t" => DateModules::shamsi_to_miladi($this->ToDate, "-")));
if (count($dt) > 0) {
ExceptionHandler::PushException("شیفت انتخاب شده دارای تداخل زمانی میباشد");
return false;
}
/*$ShiftObj = new ATN_shifts($this->ShiftID);
$dt = PdoDataAccess::runquery("select * from ATN_PersonShifts join ATN_shifts using(ShiftID)
where PersonID=:p
AND ( (:s between FromTime AND ToTime) OR (:e between FromTime AND ToTime) ) AND RowID <> :r
AND ( (:f between FromDate AND if(ToDate='0000-00-00','4000-00-00',ToDate) )
OR (:t between FromDate AND if(ToDate='0000-00-00','4000-00-00',ToDate) ) )",
array(":p" => $this->PersonID, ":s" => $ShiftObj->FromTime,
":e" => $ShiftObj->ToTime, ":r" => $this->RowID,
":f" => DateModules::shamsi_to_miladi($this->FromDate),
":t" => DateModules::shamsi_to_miladi($this->ToDate)));
if(count($dt) > 0)
{
ExceptionHandler::PushException("شیفت های این فرد با یکدیگر دارای تداخل ساعتی می باشند");;
return false;
} */
return true;
}
示例9: saveEducData
function saveEducData()
{
//........ Fill object ..............
$obj = new manage_person_education();
PdoDataAccess::FillObjectByArray($obj, $_POST);
$obj->PersonID = $_POST['PersonID'];
$obj->doc_date = DateModules::Shamsi_to_Miladi($obj->doc_date);
$obj->certificated = empty($obj->certificated) ? "0" : $obj->certificated;
//....................................
if ($_POST['sfid'] == "-1") {
$obj->sfid = PDONULL;
}
if (!isset($_POST['sbid'])) {
$obj->sbid = PDONULL;
}
if ($_POST['university_id'] == "-1") {
$obj->university_id = PDONULL;
}
if ($_POST['country_id'] == "-1") {
$obj->country_id = PDONULL;
}
if (empty($_POST["row_no"])) {
$return = $obj->AddEducation();
} else {
$return = $obj->EditEducation();
}
echo $return ? Response::createObjectiveResponse(true, $obj->row_no) : Response::createObjectiveResponse(false, ExceptionHandler::GetExceptionsToString("\n"));
die;
}
示例10: simulate_bime
public static function simulate_bime($pay_year, $pay_month, $payment_type = NULL)
{
$e_date = "31-" . $pay_month . "-" . $pay_year;
$end_month_date = DateModules::shamsi_to_miladi($e_date);
$s_date = "1-" . $pay_month . "-" . $pay_year;
$start_month_date = DateModules::shamsi_to_miladi($s_date);
$worker_month_day = 30;
$actual_month_day = DateModules::get_month_dayno($pay_year, $pay_month);
//...................................
PdoDataAccess::runquery("DROP TABLE IF EXISTS temp_insure_include_sum ");
PdoDataAccess::runquery(" DROP TABLE IF EXISTS temp_limit_staff ");
PdoDataAccess::runquery(" CREATE TEMPORARY TABLE temp_limit_staff AS\r\n\t\t\t\t\t\t\t\tSELECT DISTINCT s.staff_id , s.person_type\r\n\t\t\t\t\t\t\t\tFROM staff s\r\n\t\t\t\t\t\t\t\t\tINNER JOIN staff_include_history si\r\n\t\t\t\t\t\t\t\t\t\tON (s.staff_id = si.staff_id AND si.start_date <= ('{$end_month_date}') AND (si.end_date IS NULL OR si.end_date >= ('{$end_month_date}'))) \r\n\t\t\t\t\t\t\t\tWHERE si.insure_include = 1 ");
PdoDataAccess::runquery("ALTER TABLE temp_limit_staff ADD INDEX (staff_id)");
PdoDataAccess::runquery(" CREATE TEMPORARY table temp_insure_include_sum AS\r\n\t\t\t\t\t\t\t\tSELECT s.staff_id ,\r\n\t\t\t\t\t\t\t\t\t\t0 value,\r\n\t\t\t\t\t\t\t\t\t\tsum(pi.pay_value) + CASE WHEN sum(pi.diff_pay_value * pi.diff_value_coef) < 0 THEN 0 ELSE sum(pi.diff_pay_value * pi.diff_value_coef) END param1 ,\r\n\t\t\t\t\t\t\t\t\t\t0 param2 ,\r\n\t\t\t\t\t\t\t\t\t\t0 param3 , \r\n\t\t\t\t\t\t\t\t\t\tCASE WHEN s.person_type = " . HR_WORKER . " THEN {$worker_month_day} ELSE {$actual_month_day} END month_days\r\n\t\t\t\t\t\t\t\tFROM payment_items pi\r\n\t\t\t\t\t\t\t\tINNER JOIN salary_item_types sit\r\n\t\t\t\t\t\t\t\t\tON (pi.salary_item_type_id = sit.salary_item_type_id AND \r\n\t\t\t\t\t\t\t\t\t\tsit.credit_topic = " . CREDIT_TOPIC_1 . " AND \r\n\t\t\t\t\t\t\t\t\t\tsit.insure_include = 1)\r\n\t\t\t\t\t\t\t\tINNER JOIN temp_limit_staff s\r\n\t\t\t\t\t\t\t\t\tON (s.staff_id = pi.staff_id)\r\n\t\t\t\t\t\t\t\tWHERE pi.pay_year = ({$pay_year}) AND \r\n\t\t\t\t\t\t\t\t\tpi.pay_month = ({$pay_month}) AND \r\n\t\t\t\t\t\t\t\t\tpi.payment_type = 1\r\n\t\t\t\t\t\t\t\t\t{$payment_type_where}\r\n\t\t\t\t\t\t\t\tGROUP BY\r\n\t\t\t\t\t\t\t\tstaff_id; ");
PdoDataAccess::runquery("ALTER TABLE temp_insure_include_sum ADD INDEX (staff_id)");
$max_daily_salary_insure_include = manage_salary_params::get_salaryParam_value("", 100, SPT_MAX_DAILY_SALARY_INSURE_INCLUDE, $start_month_date);
PdoDataAccess::runquery(" UPDATE temp_insure_include_sum\r\n\t\t\t\t\t\t\t SET param1 = {$max_daily_salary_insure_include} * {$worker_month_day} \r\n\t\t\t\t\t\t\t WHERE param1 > {$max_daily_salary_insure_include} * {$worker_month_day} ");
//استخراج درصد بیمه بیکاری سهم کارفرما
$res = PdoDataAccess::runquery("SELECT value\r\n\t\t\t\t\t\t\t\t\tFROM salary_params\r\n\t\t\t\t\t\t\t\t\t\tWHERE from_date <= '" . $start_month_date . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\tto_date >= '" . $end_month_date . "' AND person_type =100 AND \r\n\t\t\t\t\t\t\t\t\t\t\tparam_type = " . SPT_UNEMPLOYMENT_INSURANCE_VALUE);
$unemployment_insurance_value = $res[0]['value'];
//استخراج درصد بیمه سهم شخص
$res = PdoDataAccess::runquery("SELECT value\r\n\t\t\t\t\t\t\t\t\tFROM salary_params\r\n\t\t\t\t\t\t\t\t\tWHERE from_date <= '" . $start_month_date . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\tto_date >= '" . $end_month_date . "' AND person_type =100 AND \r\n\t\t\t\t\t\t\t\t\t\t\tparam_type = " . SPT_SOCIAL_SUPPLY_INSURE_PERSON_VALUE);
$person_value = $res[0]['value'];
//استخراج درصد بیمه سهم کارفرما
$res = PdoDataAccess::runquery("SELECT value\r\n\t\t\t\t\t\t\t\t\tFROM salary_params\r\n\t\t\t\t\t\t\t\t\tWHERE from_date <= '" . $start_month_date . "' AND\r\n\t\t\t\t\t\t\t\t\t\t\tto_date >= '" . $end_month_date . "' AND person_type =100 AND \r\n\t\t\t\t\t\t\t\t\t\t\tparam_type = " . SPT_SOCIAL_SUPPLY_INSURE_EMPLOYER_VALUE);
$employmer_value = $res[0]['value'];
PdoDataAccess::runquery(" UPDATE temp_insure_include_sum\r\n\t\t\t\t\t\t\t\tSET value = param1 * {$person_value} ,\r\n\t\t\t\t\t\t\t\t\tparam2 = param1 * {$employmer_value} ,\r\n\t\t\t\t\t\t\t\t\tparam3 = param1 * {$unemployment_insurance_value} \r\n\t\t\t\t\t\t\t\tWHERE (1=1)");
}
示例11: newTable
function newTable()
{
$query = "insert into rp_base_tables(table_name, description) values(?,?)";
PdoDataAccess::runquery($query, array($_POST["table_name"], $_POST["description"]));
echo "true";
die;
}
示例12: selectDeposites
function selectDeposites()
{
$temp = PdoDataAccess::runquery_fetchMode("\r\n\t\tselect TafsiliID,CostID,concat_ws('-',b1.BlockDesc,b2.BlockDesc) CostDesc,\r\n\t\t\tsum(CreditorAmount-DebtorAmount) amount,TafsiliDesc\r\n\t\tfrom ACC_DocItems \r\n\t\t\tjoin ACC_docs using(DocID)\r\n\t\t\tjoin ACC_CostCodes cc using(CostID)\r\n\t\t\tleft join ACC_blocks b1 on(b1.BlockID=cc.level1)\r\n\t\t\tleft join ACC_blocks b2 on(b2.BlockID=cc.level2)\r\n\t\t\tjoin ACC_tafsilis using(TafsiliID)\r\n\t\t\r\n\t\twhere /*DocStatus != 'RAW'*/ 1=1\r\n\t\t\tAND CostID in(" . COSTID_ShortDeposite . "," . COSTID_LongDeposite . ")\r\n\t\t\tAND CycleID=" . $_SESSION["accounting"]["CycleID"] . "\r\n\t\t\tAND BranchID=" . $_SESSION["accounting"]["BranchID"] . "\r\n\t\tgroup by TafsiliID,CostID");
$dt = PdoDataAccess::fetchAll($temp, $_GET["start"], $_GET["limit"]);
//echo PdoDataAccess::GetLatestQueryString();
echo dataReader::getJsonData($dt, $temp->rowCount(), $_GET["callback"]);
die;
}
示例13: __construct
function __construct($person_type, $writ_type_id, $writ_subtype_id)
{
if ($person_type != "" && $writ_type_id != "" && $writ_subtype_id != "") {
$query = "select * from writ_subtypes \r\n\t\t\t\twhere person_type = :ptype and \r\n\t\t\t\t\t writ_type_id = :wTypeId and \r\n\t\t\t\t\t writ_subtype_id = :wSubTypeId";
$whereParam = array(":ptype" => $person_type, ":wTypeId" => $writ_type_id, ":wSubTypeId" => $writ_subtype_id);
PdoDataAccess::FillObject($this, $query, $whereParam);
}
}
示例14: DeleteWST
static function DeleteWST($id)
{
$arr = explode('-', $id);
PdoDataAccess::runquery("delete from writ_subtypes where person_type=" . $arr[3] . " and writ_type_id=" . $arr[4] . " and writ_subtype_id=" . $arr[5]);
$daObj = new DataAudit();
$daObj->ActionType = DataAudit::Action_delete;
$daObj->MainObjectID = $_POST["id"];
$daObj->TableName = "writ_subtypes";
$daObj->execute();
}
示例15: duty_year_month_day
function duty_year_month_day($staff_id = "", $personID = "", $toDate) {
if ($staff_id == "" && $personID = "") {
PdoDataAccess::PushException("يکي از دو پارامتر staff_id و PersonID بايد فرستاده شود");
return false;
}
$query = "select w.execute_date,
w.contract_start_date ,
w.contract_end_date ,
w.person_type ,
w.onduty_year ,
w.onduty_month ,
w.onduty_day ,
w.annual_effect
from writs as w";
if ($personID != "")
$query .= " join staff as s using(staff_id) where s.PersonID=" . $personID;
else if ($staff_id != "")
$query .= " where w.staff_id = $staff_id";
$query .= " AND (w.history_only != " . HISTORY_ONLY . " OR w.history_only is null) AND w.execute_date <= '$toDate'
order by w.execute_date DESC,w.writ_id DESC,w.writ_ver DESC
limit 1";
$temp = PdoDataAccess::runquery($query);
if (count($temp) == 0)
return array("year" => 0, "month" => 0, "day" => 0);
$writ_rec = $temp[0];
$temp_duration = 0;
if (DateModules::CompareDate($toDate, $writ_rec['execute_date']) >= 0)
$temp_duration = DateModules::GDateMinusGDate($toDate, $writ_rec['execute_date']);
if ($writ_rec['annual_effect'] == HALF_COMPUTED)
$temp_duration *= 0.5;
else if ($writ_rec['annual_effect'] == DOUBLE_COMPUTED)
$temp_duration *= 2;
else if ($writ_rec['annual_effect'] == NOT_COMPUTED)
$temp_duration = 0;
$prev_writ_duration = DateModules::ymd_to_days($writ_rec['onduty_year'], $writ_rec['onduty_month'], $writ_rec['onduty_day']);
$duration = $prev_writ_duration + $temp_duration;
$return = array();
DateModules::day_to_ymd($duration, $return['year'], $return['month'], $return['day']);
return $return;
}