/**
  * Searches for workflows assigned to the systemid to be deleted.
  *
  * @param string $strEventName
  * @param array $arrArguments
  *
  * @return bool
  */
 public function handleEvent($strEventName, array $arrArguments)
 {
     //unwrap arguments
     list($strSystemid, $strSourceClass) = $arrArguments;
     $bitReturn = true;
     $objORM = new class_orm_objectlist();
     $objORM->setObjHandleLogicalDeleted(class_orm_deletedhandling_enum::INCLUDED());
     $objORM->addWhereRestriction(new class_orm_objectlist_restriction(" AND workflows_systemid = ?", $strSystemid));
     if ($objORM->getObjectCount("class_module_workflows_workflow") == 0) {
         return true;
     }
     class_orm_base::setObjHandleLogicalDeletedGlobal(class_orm_deletedhandling_enum::INCLUDED());
     $arrWorkflows = class_module_workflows_workflow::getWorkflowsForSystemid($strSystemid, false);
     foreach ($arrWorkflows as $objOneWorkflow) {
         if ($strEventName == class_system_eventidentifier::EVENT_SYSTEM_RECORDDELETED_LOGICALLY) {
             $bitReturn = $bitReturn && $objOneWorkflow->deleteObject();
         }
         if ($strEventName == class_system_eventidentifier::EVENT_SYSTEM_RECORDDELETED) {
             $bitReturn = $bitReturn && $objOneWorkflow->deleteObjectFromDatabase();
         }
     }
     class_orm_base::setObjHandleLogicalDeletedGlobal(class_orm_deletedhandling_enum::EXCLUDED());
     return $bitReturn;
 }
 /**
  * Returns the number of messages for a single user - ignoring the messages states.
  *
  * @param string $strUserid
  * @param bool $bitOnlyUnread
  *
  * @return int
  */
 public static function getNumberOfMessagesForUser($strUserid, $bitOnlyUnread = false)
 {
     $objOrm = new class_orm_objectlist();
     $objOrm->addWhereRestriction(new class_orm_objectlist_property_restriction("strUser", class_orm_comparator_enum::Equal(), $strUserid));
     if ($bitOnlyUnread) {
         $objOrm->addWhereRestriction(new class_orm_objectlist_restriction("AND (message_read IS NULL OR message_read = 0 )"));
     }
     return $objOrm->getObjectCount(__CLASS__);
 }
 /**
  * @param string $strEventId
  *
  * @return int
  */
 public static function getActiveParticipantsCount($strEventId)
 {
     $objOrm = new class_orm_objectlist();
     $objOrm->addWhereRestriction(new class_orm_objectlist_restriction("AND em_pt_status != 2", array()));
     return $objOrm->getObjectCount(get_called_class(), $strEventId);
 }
 /**
  * Looks up the posts available
  *
  * @param string $strPrevID
  * @param bool $bitJustActive
  *
  * @return int
  * @static
  */
 public static function getPostsCount($strPrevID = "", $bitJustActive = false)
 {
     $objORM = new class_orm_objectlist();
     if ($bitJustActive) {
         $objORM->addWhereRestriction(new class_orm_objectlist_systemstatus_restriction(class_orm_comparator_enum::Equal(), 1));
     }
     return $objORM->getObjectCount(get_called_class(), $strPrevID);
 }
 /**
  * Counts the number of packages available
  *
  * @param bool $strCategoryFilter
  * @param bool $bitActiveOnly
  * @param bool $strNameFilter
  *
  * @return mixed
  */
 public static function getFlatPackageListCount($strCategoryFilter = false, $bitActiveOnly = false, $strNameFilter = false)
 {
     $objORM = new class_orm_objectlist();
     if ($bitActiveOnly) {
         $objORM->addWhereRestriction(new class_orm_objectlist_restriction(" AND system_status = 1 ", array()));
     }
     if ($strCategoryFilter !== false) {
         $objORM->addWhereRestriction(new class_orm_objectlist_restriction(" AND file_cat = ? ", array($strCategoryFilter)));
     }
     if ($strNameFilter !== false) {
         $arrParams = array();
         if (uniStrpos($strNameFilter, ",") !== false) {
             $arrWhere = array();
             foreach (explode(",", $strNameFilter) as $strOneLike) {
                 $arrWhere[] = " file_name = ?";
                 $arrParams[] = trim($strOneLike);
             }
             $strWhere = "AND ( " . implode(" OR ", $arrWhere) . " )";
         } else {
             $arrParams[] = $strNameFilter . "%";
             $strWhere = "AND file_name LIKE ?";
         }
         $objORM->addWhereRestriction(new class_orm_objectlist_restriction($strWhere, $arrParams));
     }
     return $objORM->getObjectCount(get_called_class());
 }
Ejemplo n.º 6
0
 /**
  * A generic approach to count the number of object currently available.
  * This method is only a simple approach to determine the number of instances in the
  * database, if you need more specific counts, overwrite this method or add your own
  * implementation to the derived class.
  *
  * @param string $strPrevid
  *
  * @return int
  */
 public static function getObjectCount($strPrevid = "")
 {
     $objORM = new class_orm_objectlist();
     return $objORM->getObjectCount(get_called_class(), $strPrevid);
 }
 /**
  * Returns the number of aspects installed in the system
  *
  * @return int
  */
 public static function getActiveObjectCount()
 {
     $objOrm = new class_orm_objectlist();
     $objOrm->addWhereRestriction(new class_orm_objectlist_systemstatus_restriction(class_orm_comparator_enum::NotEqual(), 0));
     return $objOrm->getObjectCount(__CLASS__);
 }
Ejemplo n.º 8
0
 /**
  * Checks, how many elements are on this page
  *
  * @param bool $bitJustActive
  *
  * @return int
  */
 public function getNumberOfElementsOnPage($bitJustActive = false)
 {
     $objORM = new class_orm_objectlist();
     $objORM->addWhereRestriction(new class_orm_objectlist_restriction("AND page_element_ph_language = ?", $this->getStrLanguage()));
     if ($bitJustActive) {
         $objORM->addWhereRestriction(new class_orm_objectlist_restriction("AND system_status = 1", array()));
     }
     return $objORM->getObjectCount("class_module_pages_pageelement");
 }
 /**
  * Counts the number of posts currently in the database
  *
  * @param bool $bitJustActive
  * @param string $strPageid
  * @param bool|string $strSystemidfilter false to ignore the filter
  * @param string $strLanguagefilter
  *
  * @return int
  */
 public static function getNumberOfPostsAvailable($bitJustActive = true, $strPageid = "", $strSystemidfilter = "", $strLanguagefilter = "")
 {
     $objORM = new class_orm_objectlist();
     if ($strPageid != "") {
         $objORM->addWhereRestriction(new class_orm_objectlist_restriction(" AND postacomment_page = ? ", $strPageid));
     }
     if ($strSystemidfilter != "") {
         $objORM->addWhereRestriction(new class_orm_objectlist_restriction(" AND postacomment_systemid = ? ", $strSystemidfilter));
     }
     if ($strLanguagefilter != "") {
         //check against '' to remain backwards-compatible
         $objORM->addWhereRestriction(new class_orm_objectlist_restriction(" AND (postacomment_language = ? OR postacomment_language = '')", $strLanguagefilter));
     }
     if ($bitJustActive) {
         $objORM->addWhereRestriction(new class_orm_objectlist_restriction(" AND system_status = ? ", 1));
     }
     return $objORM->getObjectCount(get_called_class());
 }
 /**
  * Counts the answers related to the current question
  *
  * @param bool $bitOnlyActive
  *
  * @return int
  */
 public function getAllAnswersCount($bitOnlyActive = false)
 {
     $objOrm = new class_orm_objectlist();
     if ($bitOnlyActive) {
         $objOrm->addWhereRestriction(new class_orm_objectlist_systemstatus_restriction(class_orm_comparator_enum::NotEqual(), 0));
     }
     return $objOrm->getObjectCount(__CLASS__);
 }
 /**
  * Counts all workflows for a given set of users
  * By default limited to those with an exceeded trigger-date, so valid to be run
  *
  * @param array $arrUserids
  * @return int
  */
 public static function getPendingWorkflowsForUserCount($arrUserids)
 {
     $objOrmMapper = new class_orm_objectlist();
     $objOrmMapper->addWhereRestriction(new class_orm_objectlist_property_restriction("intState", class_orm_comparator_enum::Equal(), (int) self::$INT_STATE_SCHEDULED));
     $objOrmMapper->addWhereRestriction(self::getUserWhereStatement($arrUserids));
     return $objOrmMapper->getObjectCount("class_module_workflows_workflow");
 }
 /**
  * Returns the number of languages installed in the system
  *
  * @param bool $bitJustActive
  *
  * @return int
  */
 public static function getNumberOfLanguagesAvailable($bitJustActive = false)
 {
     $objOrmList = new class_orm_objectlist();
     if ($bitJustActive) {
         $objOrmList->addWhereRestriction(new class_orm_objectlist_systemstatus_restriction(class_orm_comparator_enum::NotEqual(), 0));
     }
     return $objOrmList->getObjectCount(__CLASS__);
 }