本文整理汇总了PHP中ContentPeer类的典型用法代码示例。如果您正苦于以下问题:PHP ContentPeer类的具体用法?PHP ContentPeer怎么用?PHP ContentPeer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ContentPeer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getActiveLanguages
public function getActiveLanguages()
{
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(LanguagePeer::LAN_ID);
$oCriteria->addSelectColumn(LanguagePeer::LAN_NAME);
$oCriteria->add(LanguagePeer::LAN_ENABLED, '1');
$oCriteria->addDescendingOrderByColumn(LanguagePeer::LAN_WEIGHT);
$oDataset = ContentPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oContent = new Content();
$rows = array();
while ($oDataset->next()) {
array_push($rows, $oDataset->getRow());
}
return $rows;
}
示例2: deleteContent
function deleteContent($data, $fields)
{
$obj = new Content();
$ConCategory = $fields['CON_CATEGORY'];
$ConParent = $fields['CON_PARENT'];
$ConId = $fields['CON_ID'];
$ConLang = $fields['CON_LANG'];
try {
//$res = $obj->load($ConCategory, $ConParent, $ConId, $ConLang );
$content = ContentPeer::retrieveByPK($ConCategory, $ConParent, $ConId, $ConLang);
if ($content) {
$content->delete();
}
} catch (Exception $e) {
return $e;
}
return $res;
}
示例3: executeChangeGradeItem
public function executeChangeGradeItem(sfWebRequest $request)
{
if ($request->isXmlHttpRequest()) {
if ($request->getParameter('idgradeunit') != '') {
try {
updateGradeImte($request->getParameter('idgradeunit'), $request->getParameter('idhorario'), $request->getParameter('iddisciplina'), $request->getParameter('idprofessor'), $request->getParameter('idlocal'), $request->getParameter('idweekday'));
} catch (Exception $e) {
}
$c = new Criteria();
$c->add(GradeunitPeer::ID, intval($request->getParameter('idgradeunit')));
$this->content = ContentPeer::doSelectOne($c);
if ($this->content) {
$this->user = sfGuardUserPeer::retrieveByPK($this->content->getUserId());
}
return $this->content ? sfView::SUCCESS : sfView::ERROR;
}
}
$this->forward404();
}
示例4: addTask
public function addTask($sProcessUID = '', $iX = 0, $iY = 0, $iWidth = 165, $iHeight = 40)
{
try {
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn('TAS_UID');
$oCriteria->add(TaskPeer::PRO_UID, $sProcessUID);
$oDataset = TaskPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$aTasks = array();
$iTaskNumber = 0;
while ($oDataset->next()) {
$aRow = $oDataset->getRow();
$aTasks[] = $aRow["TAS_UID"];
$iTaskNumber = $iTaskNumber + 1;
}
if ($iTaskNumber > 0) {
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(ContentPeer::CON_LANG);
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
$criteria->add(ContentPeer::CON_ID, $aTasks, Criteria::IN);
$criteria->add(ContentPeer::CON_CATEGORY, "TAS_TITLE");
$rsSQLCON = ContentPeer::doSelectRS($criteria);
$rsSQLCON->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$numMaxLang = 0;
$numMax = 0;
while ($rsSQLCON->next()) {
$row = $rsSQLCON->getRow();
$conLang = $row["CON_LANG"];
$conValue = $row["CON_VALUE"];
if (preg_match("/^\\S+\\s(\\d+)\$/", $conValue, $matches)) {
$n = intval($matches[1]);
if ($conLang == SYS_LANG) {
if ($n > $numMaxLang) {
$numMaxLang = $n;
}
} else {
if ($n > $numMax) {
$numMax = $n;
}
}
}
}
if ($numMaxLang > 0) {
$numMax = $numMaxLang;
}
if ($numMax > 0 && $numMax > $iTaskNumber) {
$iTaskNumber = $numMax + 1;
} else {
$iTaskNumber = $iTaskNumber + 1;
}
} else {
$iTaskNumber = 1;
}
$oTask = new Task();
$oNewTask->label = G::LoadTranslation('ID_TASK') . ' ' . $iTaskNumber;
$oNewTask->uid = $oTask->create(array('PRO_UID' => $sProcessUID, 'TAS_TITLE' => $oNewTask->label, 'TAS_POSX' => $iX, 'TAS_POSY' => $iY, 'TAS_WIDTH' => $iWidth, 'TAS_HEIGHT' => $iHeight));
$oNewTask->statusIcons = array();
$oNewTask->statusIcons[] = array('label' => '', 'icon' => '/images/alert.gif', 'message' => '', 'url' => '');
//$oJSON = new Services_JSON();
return Bootstrap::json_encode($oNewTask);
//$oJSON->encode( $oNewTask );
} catch (Exception $oError) {
throw $oError;
}
}
示例5: getAllProcesses
function getAllProcesses($start, $limit, $category = NULL, $processName = NULL)
{
require_once PATH_RBAC . "model/RbacUsers.php";
require_once "classes/model/ProcessCategory.php";
require_once "classes/model/Users.php";
$user = new RbacUsers();
$aProcesses = array();
$categories = array();
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(ProcessPeer::PRO_UID);
$oCriteria->addSelectColumn(ProcessPeer::PRO_PARENT);
$oCriteria->addSelectColumn(ProcessPeer::PRO_STATUS);
$oCriteria->addSelectColumn(ProcessPeer::PRO_CATEGORY);
$oCriteria->addSelectColumn(ProcessPeer::PRO_CREATE_DATE);
$oCriteria->addSelectColumn(ProcessPeer::PRO_CREATE_USER);
$oCriteria->addSelectColumn(ProcessPeer::PRO_DEBUG);
$oCriteria->addSelectColumn(UsersPeer::USR_UID);
$oCriteria->addSelectColumn(UsersPeer::USR_USERNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);
$oCriteria->addSelectColumn(ProcessCategoryPeer::CATEGORY_UID);
$oCriteria->addSelectColumn(ProcessCategoryPeer::CATEGORY_NAME);
$oCriteria->add(ProcessPeer::PRO_UID, '', Criteria::NOT_EQUAL);
$oCriteria->add(ProcessPeer::PRO_STATUS, 'DISABLED', Criteria::NOT_EQUAL);
if (isset($category)) {
$oCriteria->add(ProcessPeer::PRO_CATEGORY, $category, Criteria::EQUAL);
}
$oCriteria->addJoin(ProcessPeer::PRO_CREATE_USER, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
$oCriteria->addJoin(ProcessPeer::PRO_CATEGORY, ProcessCategoryPeer::CATEGORY_UID, Criteria::LEFT_JOIN);
$this->tmpCriteria = clone $oCriteria;
if ($start != '') {
$oCriteria->setOffset($start);
}
if ($limit != '' && !isset($category) && !isset($processName)) {
$oCriteria->setLimit($limit);
}
//execute a query to obtain numbers, how many cases there are by process
$casesCnt = $this->getCasesCountInAllProcesses();
//execute the query
$oDataset = ProcessPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$processes = array();
$uids = array();
while ($oDataset->next()) {
$processes[] = $oDataset->getRow();
$uids[] = $processes[sizeof($processes) - 1]['PRO_UID'];
}
//process details will have the info about the processes
$processesDetails = array();
//now get the labels for all process, using an array of Uids,
$c = new Criteria('workflow');
//$c->add ( ContentPeer::CON_CATEGORY, 'PRO_TITLE', Criteria::EQUAL );
$c->add(ContentPeer::CON_LANG, defined('SYS_LANG') ? SYS_LANG : 'en', Criteria::EQUAL);
$c->add(ContentPeer::CON_ID, $uids, Criteria::IN);
$dt = ContentPeer::doSelectRS($c);
$dt->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($dt->next()) {
$row = $dt->getRow();
$processesDetails[$row['CON_ID']][$row['CON_CATEGORY']] = $row['CON_VALUE'];
}
G::loadClass('configuration');
$oConf = new Configurations();
$oConf->loadConfig($obj, 'ENVIRONMENT_SETTINGS', '');
foreach ($processes as $process) {
$proTitle = isset($processesDetails[$process['PRO_UID']]) && isset($processesDetails[$process['PRO_UID']]['PRO_TITLE']) ? $processesDetails[$process['PRO_UID']]['PRO_TITLE'] : '';
$proDescription = isset($processesDetails[$process['PRO_UID']]) && isset($processesDetails[$process['PRO_UID']]['PRO_DESCRIPTION']) ? $processesDetails[$process['PRO_UID']]['PRO_DESCRIPTION'] : '';
// verify if the title is already set on the current language
if (trim($proTitle) == '') {
// if not, then load the record to generate content for current language
$proData = $this->load($process['PRO_UID']);
$proTitle = $proData['PRO_TITLE'];
$proDescription = $proData['PRO_DESCRIPTION'];
}
//filtering by $processName
if (isset($processName) && $processName != '' && stripos($proTitle, $processName) === false) {
continue;
}
$casesCountTotal = 0;
if (isset($casesCnt[$process['PRO_UID']])) {
foreach ($casesCnt[$process['PRO_UID']] as $item) {
$casesCountTotal += $item;
}
}
//get user format from configuration
$userOwner = isset($oConf->aConfig['format']) ? $oConf->aConfig['format'] : '';
$creationDateMask = isset($oConf->aConfig['dateFormat']) ? $oConf->aConfig['dateFormat'] : '';
if ($userOwner != '') {
$userOwner = str_replace('@userName', $process['USR_USERNAME'], $userOwner);
$userOwner = str_replace('@firstName', $process['USR_FIRSTNAME'], $userOwner);
$userOwner = str_replace('@lastName', $process['USR_LASTNAME'], $userOwner);
if ($userOwner == " ( )") {
$userOwner = '-';
}
} else {
$userOwner = $process['USR_FIRSTNAME'] . ' ' . $process['USR_LASTNAME'];
}
//get date format from configuration
if ($creationDateMask != '') {
list($date, $time) = explode(' ', $process['PRO_CREATE_DATE']);
list($y, $m, $d) = explode('-', $date);
//.........这里部分代码省略.........
示例6: newRow
public function newRow ($data, $delPreviusUsrUid, $isInitSubprocess = false, $dataPreviusApplication = array(), $isSelfService = false)
{
$removeList = true;
if (isset($data['REMOVED_LIST'])) {
$removeList = $data['REMOVED_LIST'];
unset($data['REMOVED_LIST']);
}
$data['DEL_PREVIOUS_USR_UID'] = $delPreviusUsrUid;
if (isset($data['DEL_TASK_DUE_DATE'])) {
$data['DEL_DUE_DATE'] = $data['DEL_TASK_DUE_DATE'];
}
$criteria = new Criteria();
$criteria->addSelectColumn( ApplicationPeer::APP_NUMBER );
$criteria->addSelectColumn( ApplicationPeer::APP_UPDATE_DATE );
$criteria->add( ApplicationPeer::APP_UID, $data['APP_UID'], Criteria::EQUAL );
$dataset = ApplicationPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$aRow = $dataset->getRow();
$data = array_merge($data, $aRow);
$criteria = new Criteria();
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
$criteria->add( ContentPeer::CON_ID, $data['APP_UID'], Criteria::EQUAL );
$criteria->add( ContentPeer::CON_CATEGORY, 'APP_TITLE', Criteria::EQUAL );
$criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL );
$dataset = ContentPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$aRow = $dataset->getRow();
$data['APP_TITLE'] = $aRow['CON_VALUE'];
$criteria = new Criteria();
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
$criteria->add( ContentPeer::CON_ID, $data['PRO_UID'], Criteria::EQUAL );
$criteria->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE', Criteria::EQUAL );
$criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL );
$dataset = ContentPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$aRow = $dataset->getRow();
$data['APP_PRO_TITLE'] = $aRow['CON_VALUE'];
$criteria = new Criteria();
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
$criteria->add( ContentPeer::CON_ID, $data['TAS_UID'], Criteria::EQUAL );
$criteria->add( ContentPeer::CON_CATEGORY, 'TAS_TITLE', Criteria::EQUAL );
$criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL );
$dataset = ContentPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$aRow = $dataset->getRow();
$data['APP_TAS_TITLE'] = $aRow['CON_VALUE'];
$data['APP_PREVIOUS_USER'] = '';
if ($data['DEL_PREVIOUS_USR_UID'] != '') {
$criteria = new Criteria();
$criteria->addSelectColumn(UsersPeer::USR_USERNAME);
$criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
$criteria->add( UsersPeer::USR_UID, $data['DEL_PREVIOUS_USR_UID'], Criteria::EQUAL );
$dataset = UsersPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$aRow = $dataset->getRow();
$data['DEL_PREVIOUS_USR_USERNAME'] = $aRow['USR_USERNAME'];
$data['DEL_PREVIOUS_USR_FIRSTNAME'] = $aRow['USR_FIRSTNAME'];
$data['DEL_PREVIOUS_USR_LASTNAME'] = $aRow['USR_LASTNAME'];
}
$users = new Users();
$criteria = new Criteria();
$criteria->addSelectColumn(SubApplicationPeer::DEL_INDEX_PARENT);
$criteria->add( SubApplicationPeer::APP_PARENT, $data['APP_UID'], Criteria::EQUAL );
$dataset = SubApplicationPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($dataset->next()) {
$aSub = $dataset->getRow();
if ($aSub['DEL_INDEX_PARENT'] == $data['DEL_PREVIOUS'] && !$isSelfService) {
$users->refreshTotal($data['USR_UID'], 'add', 'inbox');
self::create($data, $isSelfService);
return 1;
}
}
if (!$isInitSubprocess) {
if ($data['APP_STATUS'] == 'DRAFT') {
$users->refreshTotal($data['USR_UID'], 'add', 'draft');
} else {
$oRow = ApplicationPeer::retrieveByPK($data['APP_UID']);
$aFields = $oRow->toArray( BasePeer::TYPE_FIELDNAME );
if ($removeList) {
if ($data['DEL_INDEX'] == 2 || $aFields['APP_STATUS'] == 'DRAFT') {
$criteria = new Criteria();
$criteria->addSelectColumn(SubApplicationPeer::APP_UID);
//.........这里部分代码省略.........
示例7: fromArray
/**
* Populates the object using an array.
*
* This is particularly useful when populating an object from one of the
* request arrays (e.g. $_POST). This method goes through the column
* names, checking to see whether a matching key exists in populated
* array. If so the setByName() method is called for that column.
*
* You can specify the key type of the array by additionally passing one
* of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* The default key type is the column's phpname (e.g. 'AuthorId')
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
* @return void
*/
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
{
$keys = ContentPeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) {
$this->setId($arr[$keys[0]]);
}
if (array_key_exists($keys[1], $arr)) {
$this->setTemplate($arr[$keys[1]]);
}
if (array_key_exists($keys[2], $arr)) {
$this->setParent($arr[$keys[2]]);
}
if (array_key_exists($keys[3], $arr)) {
$this->setPagetitle($arr[$keys[3]]);
}
if (array_key_exists($keys[4], $arr)) {
$this->setDescription($arr[$keys[4]]);
}
}
示例8: getAllProcesses
public function getAllProcesses($start, $limit, $category = null, $processName = null, $counters = true, $reviewSubProcess = false, $userLogged = "")
{
require_once PATH_RBAC . "model/RbacUsers.php";
require_once "classes/model/ProcessCategory.php";
require_once "classes/model/Users.php";
$user = new RbacUsers();
$aProcesses = array();
$categories = array();
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(ProcessPeer::PRO_UID);
$oCriteria->addSelectColumn(ProcessPeer::PRO_PARENT);
$oCriteria->addSelectColumn(ProcessPeer::PRO_STATUS);
$oCriteria->addSelectColumn(ProcessPeer::PRO_TYPE);
$oCriteria->addSelectColumn(ProcessPeer::PRO_CATEGORY);
$oCriteria->addSelectColumn(ProcessPeer::PRO_UPDATE_DATE);
$oCriteria->addSelectColumn(ProcessPeer::PRO_CREATE_DATE);
$oCriteria->addSelectColumn(ProcessPeer::PRO_CREATE_USER);
$oCriteria->addSelectColumn(ProcessPeer::PRO_DEBUG);
$oCriteria->addSelectColumn(ProcessPeer::PRO_TYPE_PROCESS);
$oCriteria->addSelectColumn(UsersPeer::USR_UID);
$oCriteria->addSelectColumn(UsersPeer::USR_USERNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);
$oCriteria->addSelectColumn(ProcessCategoryPeer::CATEGORY_UID);
$oCriteria->addSelectColumn(ProcessCategoryPeer::CATEGORY_NAME);
$oCriteria->add(ProcessPeer::PRO_UID, '', Criteria::NOT_EQUAL);
$oCriteria->add(ProcessPeer::PRO_STATUS, 'DISABLED', Criteria::NOT_EQUAL);
if ($reviewSubProcess) {
$oCriteria->add(ProcessPeer::PRO_SUBPROCESS, '1', Criteria::NOT_EQUAL);
}
if (isset($category)) {
$oCriteria->add(ProcessPeer::PRO_CATEGORY, $category, Criteria::EQUAL);
}
$oCriteria->addJoin(ProcessPeer::PRO_CREATE_USER, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
$oCriteria->addJoin(ProcessPeer::PRO_CATEGORY, ProcessCategoryPeer::CATEGORY_UID, Criteria::LEFT_JOIN);
if ($this->sort == "PRO_CREATE_DATE") {
if ($this->dir == "DESC") {
$oCriteria->addDescendingOrderByColumn(ProcessPeer::PRO_CREATE_DATE);
} else {
$oCriteria->addAscendingOrderByColumn(ProcessPeer::PRO_CREATE_DATE);
}
}
if ($userLogged != "") {
$oCriteria->add($oCriteria->getNewCriterion(ProcessPeer::PRO_TYPE_PROCESS, "PUBLIC", Criteria::EQUAL)->addOr($oCriteria->getNewCriterion(ProcessPeer::PRO_CREATE_USER, $userLogged, Criteria::EQUAL)));
}
$this->tmpCriteria = clone $oCriteria;
//execute a query to obtain numbers, how many cases there are by process
if ($counters) {
$casesCnt = $this->getCasesCountInAllProcesses();
}
// getting bpmn projects
$c = new Criteria('workflow');
$c->addSelectColumn(BpmnProjectPeer::PRJ_UID);
$ds = ProcessPeer::doSelectRS($c, Propel::getDbConnection('workflow_ro'));
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$bpmnProjects = array();
while ($ds->next()) {
$row = $ds->getRow();
$bpmnProjects[] = $row['PRJ_UID'];
}
//execute the query
$oDataset = ProcessPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$processes = array();
$uids = array();
while ($oDataset->next()) {
$row = $oDataset->getRow();
$row["PROJECT_TYPE"] = $row["PRO_TYPE"] == "NORMAL" ? in_array($row["PRO_UID"], $bpmnProjects) ? "bpmn" : "classic" : $row["PRO_TYPE"];
$processes[] = $row;
$uids[] = $processes[sizeof($processes) - 1]['PRO_UID'];
}
//process details will have the info about the processes
$processesDetails = array();
//now get the labels for all process, using an array of Uids,
$c = new Criteria('workflow');
//$c->add ( ContentPeer::CON_CATEGORY, 'PRO_TITLE', Criteria::EQUAL );
$c->add(ContentPeer::CON_LANG, defined('SYS_LANG') ? SYS_LANG : 'en', Criteria::EQUAL);
$c->add(ContentPeer::CON_ID, $uids, Criteria::IN);
$dt = ContentPeer::doSelectRS($c, Propel::getDbConnection('workflow_ro'));
$dt->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($dt->next()) {
$row = $dt->getRow();
$processesDetails[$row['CON_ID']][$row['CON_CATEGORY']] = $row['CON_VALUE'];
}
G::loadClass('configuration');
$oConf = new Configurations();
$oConf->loadConfig($obj, 'ENVIRONMENT_SETTINGS', '');
foreach ($processes as $process) {
$proTitle = isset($processesDetails[$process['PRO_UID']]) && isset($processesDetails[$process['PRO_UID']]['PRO_TITLE']) ? $processesDetails[$process['PRO_UID']]['PRO_TITLE'] : '';
$proDescription = isset($processesDetails[$process['PRO_UID']]) && isset($processesDetails[$process['PRO_UID']]['PRO_DESCRIPTION']) ? $processesDetails[$process['PRO_UID']]['PRO_DESCRIPTION'] : '';
$process["PRO_TYPE_PROCESS"] = $process["PRO_TYPE_PROCESS"] == "PUBLIC" ? G::LoadTranslation("ID_PUBLIC") : G::LoadTranslation("ID_PRIVATE");
// verify if the title is already set on the current language
if (trim($proTitle) == '') {
// if not, then load the record to generate content for current language
$proData = $this->load($process['PRO_UID']);
$proTitle = $proData['PRO_TITLE'];
$proDescription = $proData['PRO_DESCRIPTION'];
}
//filtering by $processName
if (isset($processName) && $processName != '' && stripos($proTitle, $processName) === false) {
//.........这里部分代码省略.........
示例9: getAllContentsByRole
function getAllContentsByRole($sys_lang = SYS_LANG)
{
if (!isset($sys_lang)) {
$sys_lang = 'en';
}
$oCriteria = new Criteria('workflow');
$oCriteria->clearSelectColumns();
$oCriteria->addSelectColumn(ContentPeer::CON_ID);
$oCriteria->addAsColumn('ROL_NAME', ContentPeer::CON_VALUE);
//$oCriteria->addAsColumn('ROL_UID', ContentPeer::CON_ID);
$oCriteria->add(ContentPeer::CON_CATEGORY, 'ROL_NAME');
$oCriteria->add(ContentPeer::CON_LANG, $sys_lang);
$oDataset = ContentPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$aRoles = array();
while ($oDataset->next()) {
$xRow = $oDataset->getRow();
$aRoles[$xRow['CON_ID']] = $xRow['ROL_NAME'];
}
return $aRoles;
}
示例10: delete
/**
* Implementation for 'DELETE' method for Rest API
*
* @param mixed $conCategory, $conParent, $conId, $conLang Primary key
*
* @return array $result Returns array within multiple records or a single record depending if
* a single selection was requested passing id(s) as param
*/
protected function delete($conCategory, $conParent, $conId, $conLang)
{
$conn = Propel::getConnection(ContentPeer::DATABASE_NAME);
try {
$conn->begin();
$obj = ContentPeer::retrieveByPK($conCategory, $conParent, $conId, $conLang);
if (!is_object($obj)) {
throw new RestException(412, G::LoadTranslation('ID_RECORD_DOES_NOT_EXIST'));
}
$obj->delete();
$conn->commit();
} catch (Exception $e) {
$conn->rollback();
throw new RestException(412, $e->getMessage());
}
}
示例11: Criteria
$criteria = new Criteria();
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
$criteria->add(ContentPeer::CON_ID, $copyDynaformGridUid);
$criteria->add(ContentPeer::CON_CATEGORY, "DYN_TITLE");
$criteria->add(ContentPeer::CON_LANG, SYS_LANG);
$rsCriteria = ContentPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rsCriteria->next();
$row = $rsCriteria->getRow();
$copyDynGrdTitle = $row["CON_VALUE"];
$criteria = new Criteria();
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
$criteria->add(ContentPeer::CON_ID, $copyDynaformGridUid);
$criteria->add(ContentPeer::CON_CATEGORY, "DYN_DESCRIPTION");
$criteria->add(ContentPeer::CON_LANG, SYS_LANG);
$rsCriteria = ContentPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rsCriteria->next();
$row = $rsCriteria->getRow();
$copyDynGrdDescription = $row["CON_VALUE"];
//Create grid
$dynaformGrid = new dynaform();
$aDataAux = $aData;
$aDataAux["DYN_TYPE"] = "grid";
$aDataAux["DYN_TITLE"] = $copyDynGrdTitle . ($dynaFormAux->existsTitle($dynaform->getProUid(), $copyDynGrdTitle) ? " (" . $dynaform->getDynTitle() . ")" : "");
$aDataAux["DYN_DESCRIPTION"] = $copyDynGrdDescription;
$aFields = $dynaformGrid->create($aDataAux);
$dynaformGridUid = $dynaformGrid->getDynUid();
$aDataAux["DYN_UID"] = $dynaformGridUid;
$dynaformGrid->update($aDataAux);
//Copy files of the dynaform grid
示例12: doSelectJoinAll
/**
* Selects a collection of Disciplina objects pre-filled with all related objects.
*
* @param Criteria $criteria
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return array Array of Disciplina objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$criteria = clone $criteria;
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
}
DisciplinaPeer::addSelectColumns($criteria);
$startcol2 = DisciplinaPeer::NUM_COLUMNS - DisciplinaPeer::NUM_LAZY_LOAD_COLUMNS;
ContentPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (ContentPeer::NUM_COLUMNS - ContentPeer::NUM_LAZY_LOAD_COLUMNS);
$criteria->addJoin(DisciplinaPeer::CONTENT_ID, ContentPeer::ID, $join_behavior);
// symfony_behaviors behavior
foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) {
call_user_func($sf_hook, 'BaseDisciplinaPeer', $criteria, $con);
}
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = DisciplinaPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = DisciplinaPeer::getInstanceFromPool($key1))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://propel.phpdb.org/trac/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = DisciplinaPeer::getOMClass(false);
$obj1 = new $cls();
$obj1->hydrate($row);
DisciplinaPeer::addInstanceToPool($obj1, $key1);
}
// if obj1 already loaded
// Add objects for joined Content rows
$key2 = ContentPeer::getPrimaryKeyHashFromRow($row, $startcol2);
if ($key2 !== null) {
$obj2 = ContentPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = ContentPeer::getOMClass(false);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
ContentPeer::addInstanceToPool($obj2, $key2);
}
// if obj2 loaded
// Add the $obj1 (Disciplina) to the collection in $obj2 (Content)
$obj2->addDisciplina($obj1);
}
// if joined row not null
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
示例13: verifyNameTrigger
/**
* Verify name for trigger in process
* @var string $sProcessUID. Uid for Process
* @var string $sTriggerName. Name for Trigger
* @var string $sTriggerUid. Uid for Trigger
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return boolean
*/
public function verifyNameTrigger($sProcessUID, $sTriggerName, $sTriggerUid = '')
{
$oCriteria = new \Criteria("workflow");
$oCriteria->addSelectColumn(\TriggersPeer::TRI_UID);
$oCriteria->add(\TriggersPeer::PRO_UID, $sProcessUID);
if ($sTriggerUid != '') {
$oCriteria->add(\TriggersPeer::TRI_UID, $sTriggerUid, \Criteria::NOT_EQUAL);
}
$oDataset = \TriggersPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($oDataset->next()) {
$aRow = $oDataset->getRow();
$oCriteria1 = new \Criteria('workflow');
$oCriteria1->addSelectColumn('COUNT(*) AS TRIGGERS');
$oCriteria1->add(\ContentPeer::CON_CATEGORY, 'TRI_TITLE');
$oCriteria1->add(\ContentPeer::CON_ID, $aRow['TRI_UID']);
$oCriteria1->add(\ContentPeer::CON_VALUE, $sTriggerName);
$oCriteria1->add(\ContentPeer::CON_LANG, SYS_LANG);
$oDataset1 = \ContentPeer::doSelectRS($oCriteria1);
$oDataset1->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$oDataset1->next();
$aRow1 = $oDataset1->getRow();
if ($aRow1['TRIGGERS']) {
return false;
}
}
return true;
}
示例14: update
public function update($fields)
{
require_once "classes/model/AppCacheView.php";
require_once "classes/model/Configuration.php";
$con = Propel::getConnection(TaskPeer::DATABASE_NAME);
try {
$con->begin();
$this->load($fields["TAS_UID"]);
$this->fromArray($fields, BasePeer::TYPE_FIELDNAME);
if ($this->validate()) {
$taskDefTitlePrevious = null;
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(ContentPeer::CON_VALUE);
$criteria->add(ContentPeer::CON_CATEGORY, "TAS_DEF_TITLE");
$criteria->add(ContentPeer::CON_ID, $fields["TAS_UID"]);
$criteria->add(ContentPeer::CON_LANG, SYS_LANG);
$rsCriteria = ContentPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$taskDefTitlePrevious = $row["CON_VALUE"];
}
$contentResult = 0;
if (array_key_exists("TAS_TITLE", $fields)) {
$contentResult += $this->setTasTitle($fields["TAS_TITLE"]);
}
if (array_key_exists("TAS_DESCRIPTION", $fields)) {
$contentResult += $this->setTasDescription($fields["TAS_DESCRIPTION"]);
}
if (array_key_exists("TAS_DEF_TITLE", $fields)) {
$contentResult += $this->setTasDefTitle($fields["TAS_DEF_TITLE"]);
}
if (array_key_exists("TAS_DEF_DESCRIPTION", $fields)) {
$contentResult += $this->setTasDefDescription($fields["TAS_DEF_DESCRIPTION"]);
}
if (array_key_exists("TAS_DEF_PROC_CODE", $fields)) {
$contentResult += $this->setTasDefProcCode($fields["TAS_DEF_PROC_CODE"]);
}
if (array_key_exists("TAS_DEF_MESSAGE", $fields)) {
$contentResult += $this->setTasDefMessage(trim($fields["TAS_DEF_MESSAGE"]));
}
if (array_key_exists("TAS_DEF_SUBJECT_MESSAGE", $fields)) {
$contentResult += $this->setTasDefSubjectMessage(trim($fields["TAS_DEF_SUBJECT_MESSAGE"]));
}
if (array_key_exists("TAS_CALENDAR", $fields)) {
$contentResult += $this->setTasCalendar($fields['TAS_UID'], $fields["TAS_CALENDAR"]);
}
$result = $this->save();
$result = $result == 0 ? $contentResult > 0 ? 1 : 0 : $result;
$con->commit();
if ($result == 1 && array_key_exists("TAS_DEF_TITLE", $fields) && $fields["TAS_DEF_TITLE"] != $taskDefTitlePrevious) {
$criteria = new Criteria("workflow");
$criteria->addAsColumn("APPCV_NUM_ROWS", "COUNT(DISTINCT " . AppCacheViewPeer::APP_UID . ")");
$criteria->add(AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN");
$criteria->add(AppCacheViewPeer::TAS_UID, $fields["TAS_UID"]);
$rsCriteria = AppCacheViewPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rsCriteria->next();
$row = $rsCriteria->getRow();
$appcvNumRows = intval($row["APPCV_NUM_ROWS"]);
if ($appcvNumRows <= 1000) {
$appcv = new AppCacheView();
$appcv->appTitleByTaskCaseLabelUpdate($fields["TAS_UID"], SYS_LANG);
$result = 2;
} else {
//Delete record
$criteria = new Criteria("workflow");
$criteria->add(ConfigurationPeer::CFG_UID, "TAS_APP_TITLE_UPDATE");
$criteria->add(ConfigurationPeer::OBJ_UID, $fields["TAS_UID"]);
$criteria->add(ConfigurationPeer::CFG_VALUE, SYS_LANG);
$numRowDeleted = ConfigurationPeer::doDelete($criteria);
//Insert record
$conf = new Configuration();
$conf->create(array("CFG_UID" => "TAS_APP_TITLE_UPDATE", "OBJ_UID" => $fields["TAS_UID"], "CFG_VALUE" => SYS_LANG, "PRO_UID" => "", "USR_UID" => "", "APP_UID" => ""));
$result = 3;
}
}
return $result;
} else {
$con->rollback();
throw new Exception("Failed Validation in class " . get_class($this) . ".");
}
} catch (Exception $e) {
$con->rollback();
throw $e;
}
}
示例15: retrieveByPKs
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(ContentPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(ContentPeer::DATABASE_NAME);
$criteria->add(ContentPeer::ID, $pks, Criteria::IN);
$objs = ContentPeer::doSelect($criteria, $con);
}
return $objs;
}