function SelectContracts() { $where = ""; $params = array(); if (!empty($_REQUEST["ContractID"])) { $where .= " AND ContractID=:c"; $params[":c"] = $_REQUEST["ContractID"]; } $temp = CNT_contracts::Get(isset($_REQUEST["content"]), $where, $params, dataReader::makeOrder()); $res = PdoDataAccess::fetchAll($temp, $_GET['start'], $_GET['limit']); for ($i = 0; $i < count($res); $i++) { $arr = WFM_FlowRows::GetFlowInfo(2, $res[$i]["ContractID"]); $res[$i]["IsStarted"] = $arr["IsStarted"] ? "YES" : "NO"; $res[$i]["IsEnded"] = $arr["IsEnded"] ? "YES" : "NO"; $res[$i]["StepDesc"] = $arr["StepDesc"]; } echo dataReader::getJsonData($res, $temp->rowCount(), $_GET["callback"]); die; }
<?php //----------------------------- // Programmer : Fatemipour // Date : 94.08 //----------------------------- require_once '../header.inc.php'; require_once 'contract.class.php'; require_once '../templates/templates.class.php'; $CntObj = new CNT_contracts($_REQUEST['ContractID']); $ContractRecord = CNT_contracts::Get(false, " AND ContractID=?", array($CntObj->ContractID)); $ContractRecord = $ContractRecord->fetch(); $temp = CNT_TemplateItems::Get(" AND TemplateID in(0,?)", array($CntObj->TemplateID)); $TplItems = $temp->fetchAll(); $TplItemsStore = array(); foreach ($TplItems as $it) { $TplItemsStore[$it['TemplateItemID']] = $it; } $res = explode(CNTconfig::TplItemSeperator, $CntObj->content); $CntItems = CNT_ContractItems::GetContractItems($CntObj->ContractID); $ValuesStore = array(); foreach ($CntItems as $it) { $ValuesStore[$it['TemplateItemID']] = $it['ItemValue']; } if (substr($CntObj->content, 0, 3) == CNTconfig::TplItemSeperator) { $res = array_merge(array(''), $res); } $st = ''; for ($i = 0; $i < count($res); $i++) { if ($i % 2 != 0) { if (isset($ValuesStore[$res[$i]])) {