示例#1
0
 /**
  * Convert the raw XML into an object
  *
  * @param \SimpleXMLElement $xml
  * @return Activity
  */
 public static function createFromXML(\SimpleXMLElement $xml)
 {
     $activity = new Activity();
     if (isset($xml->attributes()['count'])) {
         $activity->setCount((int) $xml->attributes()['count']);
     }
     if (isset($xml->attributes()['type'])) {
         $activity->setType((string) $xml->attributes()['type']);
     }
     return $activity;
 }
示例#2
0
 function getActivity($activity_id)
 {
     $query = "select * from `" . GALAXIA_TABLE_PREFIX . "activities` where `activity_id`=?";
     $result = $this->mDb->query($query, array($activity_id));
     if (!$result->numRows()) {
         return false;
     }
     $res = $result->fetchRow();
     switch ($res['act_type']) {
         case 'start':
             $act = new Start();
             break;
         case 'end':
             $act = new End();
             break;
         case 'join':
             $act = new Join();
             break;
         case 'split':
             $act = new Split();
             break;
         case 'standalone':
             $act = new Standalone();
             break;
         case 'switch':
             $act = new SwitchActivity();
             break;
         case 'activity':
             $act = new Activity();
             break;
         default:
             trigger_error('Unknown activity type:' . $res['act_type'], E_USER_WARNING);
     }
     $act->setName($res['name']);
     $act->setProcessId($res['p_id']);
     $act->setNormalizedName($res['normalized_name']);
     $act->setDescription($res['description']);
     $act->setIsInteractive($res['is_interactive']);
     $act->setIsAutoRouted($res['is_auto_routed']);
     $act->setActivityId($res['activity_id']);
     $act->setType($res['act_type']);
     //Now get forward transitions
     //Now get backward transitions
     //Now get roles
     $query = "select `role_id` from `" . GALAXIA_TABLE_PREFIX . "activity_roles` where `activity_id`=?";
     $result = $this->mDb->query($query, array($res['activity_id']));
     while ($res = $result->fetchRow()) {
         $this->roles[] = $res['role_id'];
     }
     $act->setRoles($this->roles);
     return $act;
 }
示例#3
0
 /**
  * This function never fails.
  */
 protected static function fire($type)
 {
     try {
         $activity = new Activity();
         try {
             $activity->setProfileId(UserHelper::getProfileId());
         } catch (fException $e) {
             $activity->setProfileId(NULL);
         }
         $activity->setRealname(UserHelper::getDisplayName());
         $activity->setType($type);
         $activity->store();
     } catch (Exception $e) {
         // do nothing
     }
 }
		/**
		* Public function that Gets a list of first 50 Activities in the account
		* 
		* @return array $allActivities - array of two arrays, array 1 is activity objects, array 2 is link for next 50 activities
		*/
		public function listActivities()
		{
			$utility = new Utility();
			$return = $utility->httpGet($utility->getApiPath() . '/ws/customers/'. $utility->getLogin() .'/activities');
			$allActivities = array();
			
			$activityList = array();
			$pages = array();

			$parsedReturn = simplexml_load_string($return['xml']);
			
			foreach ($parsedReturn->entry as $item)
			{
				$activity = new Activity();
				$activity->setLink($item->link['href']);
				$activity->setId($item->id);
				$activity->setActivityTitle($item->content->title);
				$activity->setType($item->content->Activity->Type);
				$activity->setStatus($item->content->Activity->Status);
				$activity->setTransactionCount($item->content->Activity->TransactionCount);
				$activity->setErrorCount($item->content->Activity->Errors);
				$activity->setRunStartTime($item->content->Activity->RunStartTime);
				$activity->setRunFinishTime($item->content->Activity->RunFinishTime);
				$activity->setInsertTime($item->content->Activity->InsertTime);
				
				$activityList[] = $activity;
			}

			if ($parsedReturn->link[2])
			{
				$pages[] = $parsedReturn->link[2]->Attributes()->href;
			}
			
			$allActivities = array($activityList, $pages);
			
			return $allActivities;
		}