本文整理汇总了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;
}
}