本文整理匯總了PHP中Process::getAllProcessesByCategory方法的典型用法代碼示例。如果您正苦於以下問題:PHP Process::getAllProcessesByCategory方法的具體用法?PHP Process::getAllProcessesByCategory怎麽用?PHP Process::getAllProcessesByCategory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Process
的用法示例。
在下文中一共展示了Process::getAllProcessesByCategory方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: trim
$catName = trim($_REQUEST['category']);
$pcat = new ProcessCategory();
$pcat->setNew(false);
$pcat->setCategoryUid($catUID);
$pcat->setCategoryName($catName);
$pcat->save();
g::auditLog("UpdateCategory", "Category Name: " . $catName . " Category ID: (" . $catUID . ") ");
echo '{success: true}';
} catch (Exception $ex) {
echo '{success: false, error: ' . $ex->getMessage() . '}';
}
break;
case 'canDeleteCategory':
require_once 'classes/model/Process.php';
$proc = new Process();
$aProcess = $proc->getAllProcessesByCategory();
$catUID = $_REQUEST['CAT_UID'];
$response = isset($aProcess[$catUID]) ? 'false' : 'true';
echo $response;
break;
case 'deleteCategory':
try {
require_once 'classes/model/ProcessCategory.php';
$catUID = $_REQUEST['cat_uid'];
$cat = new ProcessCategory();
$cat->setCategoryUid($catUID);
$catName = $cat->loadByCategoryId($catUID);
$cat->delete();
G::auditLog("DeleteCategory", "Category Name: " . $catName . " Category ID: (" . $catUID . ") ");
echo '{success: true}';
} catch (Exception $ex) {
示例2: getCategory
/**
* Get data of a Category
*
* @param string $categoryUid Unique id of Category
* @param bool $flagGetRecord Value that set the getting
*
* return array Return an array with data of a Category
*/
public function getCategory($categoryUid, $flagGetRecord = false)
{
try {
//Verify data
$this->throwExceptionIfNotExistsCategory($categoryUid, $this->arrayFieldNameForException["categoryUid"]);
//Set variables
if (!$flagGetRecord) {
$process = new \Process();
$arrayTotalProcessesByCategory = $process->getAllProcessesByCategory();
}
//Get data
//SQL
$criteria = $this->getCategoryCriteria();
$criteria->add(\ProcessCategoryPeer::CATEGORY_UID, $categoryUid, \Criteria::EQUAL);
$rsCriteria = \ProcessCategoryPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$rsCriteria->next();
$row = $rsCriteria->getRow();
if (!$flagGetRecord) {
$row["CATEGORY_TOTAL_PROCESSES"] = isset($arrayTotalProcessesByCategory[$row["CATEGORY_UID"]]) ? (int) $arrayTotalProcessesByCategory[$row["CATEGORY_UID"]] : 0;
}
//Return
return !$flagGetRecord ? $this->getCategoryDataFromRecord($row) : $row;
} catch (\Exception $e) {
throw $e;
}
}