Example #1
0
 /**
  * Get Application data by appUid
  *
  * @param string $app_uid Unique id of the app
  * @param string $index
  *
  * return row app_cache_view
  *
  */
 public function getDraftApp($app_uid, $index = 1)
 {
     $c = new \Criteria('workflow');
     $c->clearSelectColumns();
     $c->addSelectColumn(\AppCacheViewPeer::APP_NUMBER);
     $c->addSelectColumn(\AppCacheViewPeer::APP_STATUS);
     $c->addSelectColumn(\AppCacheViewPeer::DEL_INDEX);
     $c->addSelectColumn(\AppCacheViewPeer::APP_DEL_PREVIOUS_USER);
     $c->addSelectColumn(\AppCacheViewPeer::DEL_DELEGATE_DATE);
     $c->addSelectColumn(\AppCacheViewPeer::USR_UID);
     $c->addSelectColumn(\AppCacheViewPeer::PRO_UID);
     $c->addSelectColumn(\AppCacheViewPeer::APP_PRO_TITLE);
     $c->addSelectColumn(\AppCacheViewPeer::APP_TAS_TITLE);
     $c->addSelectColumn(\AppCacheViewPeer::DEL_THREAD_STATUS);
     $c->addSelectColumn(\AppCacheViewPeer::TAS_UID);
     $c->addSelectColumn(\AppCacheViewPeer::DEL_LAST_INDEX);
     $c->add(\AppCacheViewPeer::APP_UID, $app_uid);
     $c->add(\AppCacheViewPeer::DEL_INDEX, $index);
     $rs = \AppCacheViewPeer::doSelectRS($c);
     $rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
     $rows = array();
     while ($rs->next()) {
         $rows[] = $rs->getRow();
     }
     return $rows;
 }
 function getCalendarBusinessHours($CalendarUid)
 {
     $Criteria = new Criteria('workflow');
     $Criteria->clearSelectColumns();
     $Criteria->addSelectColumn(CalendarBusinessHoursPeer::CALENDAR_UID);
     $Criteria->addSelectColumn(CalendarBusinessHoursPeer::CALENDAR_BUSINESS_DAY);
     $Criteria->addSelectColumn(CalendarBusinessHoursPeer::CALENDAR_BUSINESS_START);
     $Criteria->addSelectColumn(CalendarBusinessHoursPeer::CALENDAR_BUSINESS_END);
     $Criteria->add(CalendarBusinessHoursPeer::CALENDAR_UID, $CalendarUid, CRITERIA::EQUAL);
     $Criteria->addDescendingOrderByColumn(CalendarBusinessHoursPeer::CALENDAR_BUSINESS_DAY);
     $Criteria->addAscendingOrderByColumn(CalendarBusinessHoursPeer::CALENDAR_BUSINESS_START);
     //$Criteria->addDescendingOrderByColumn ( CalendarBusinessHoursPeer::CALENDAR_BUSINESS_START );
     $rs = CalendarBusinessHoursPeer::doSelectRS($Criteria);
     $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $rs->next();
     $row = $rs->getRow();
     $fields = array();
     $count = 0;
     while (is_array($row)) {
         $count++;
         $fields[$count] = $row;
         $rs->next();
         $row = $rs->getRow();
     }
     return $fields;
 }
 protected static function _getItemsPKsVotedByUsers($users_pks, $voting_attitude = null, $model = null)
 {
     $c = new Criteria();
     $c->setDistinct();
     $c->clearSelectColumns();
     $c->addSelectColumn(self::VOTABLE_ID);
     // analyze voting attitude
     if (!is_null($voting_attitude)) {
         if ($voting_attitude > 0) {
             $c->add(self::VOTING, 0, Criteria::GREATER_THAN);
         } elseif ($voting_attitude < 0) {
             $c->add(self::VOTING, 0, Criteria::LESS_THAN);
         } else {
             $c->add(self::VOTING, 0);
         }
     }
     $c->add(self::USER_ID, $users_pks, Criteria::IN);
     if (!is_null($model)) {
         $c->add(self::VOTABLE_MODEL, $model);
     }
     $rs = self::doSelectRS($c);
     $pks = array();
     while ($rs->next()) {
         $pks[] = $rs->getInt(1);
     }
     return $pks;
 }
 function getCalendarCriterias($filter, $start, $limit)
 {
     $Criteria = new Criteria('workflow');
     $Criteria->clearSelectColumns();
     $Criteria->addSelectColumn(CalendarDefinitionPeer::CALENDAR_UID);
     if ($filter != '') {
         $Criteria->add($Criteria->getNewCriterion(CalendarDefinitionPeer::CALENDAR_NAME, '%' . $filter . '%', Criteria::LIKE)->addOr($Criteria->getNewCriterion(CalendarDefinitionPeer::CALENDAR_DESCRIPTION, '%' . $filter . '%', Criteria::LIKE)));
     }
     $Criteria->add(CalendarDefinitionPeer::CALENDAR_STATUS, 'DELETED', Criteria::NOT_EQUAL);
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(CalendarDefinitionPeer::CALENDAR_UID);
     $oCriteria->addSelectColumn(CalendarDefinitionPeer::CALENDAR_NAME);
     $oCriteria->addSelectColumn(CalendarDefinitionPeer::CALENDAR_CREATE_DATE);
     $oCriteria->addSelectColumn(CalendarDefinitionPeer::CALENDAR_UPDATE_DATE);
     $oCriteria->addSelectColumn(CalendarDefinitionPeer::CALENDAR_DESCRIPTION);
     $oCriteria->addSelectColumn(CalendarDefinitionPeer::CALENDAR_STATUS);
     if ($filter != '') {
         $oCriteria->add($oCriteria->getNewCriterion(CalendarDefinitionPeer::CALENDAR_NAME, '%' . $filter . '%', Criteria::LIKE)->addOr($oCriteria->getNewCriterion(CalendarDefinitionPeer::CALENDAR_DESCRIPTION, '%' . $filter . '%', Criteria::LIKE)));
     }
     $oCriteria->add(CalendarDefinitionPeer::CALENDAR_STATUS, 'DELETED', Criteria::NOT_EQUAL);
     $oCriteria->setLimit($limit);
     $oCriteria->setOffset($start);
     $criterias = array();
     $criterias['COUNTER'] = $Criteria;
     $criterias['LIST'] = $oCriteria;
     return $criterias;
 }
 /**
  * Return a hash with a list of ids of objects bookmarked (+|-) by a user
  * bookmarked_ids = array('OppAtto' => array(1, 15, 143), ...);
  *
  * @param  char(1)     +|- type of bookmarking
  * @param  mixed       $user_id  User primary key
  * @return array (see description)
  **/
 private static function _getAllBookmarkedIds($type, $user_id)
 {
     if ($type != '+' && $type != '-') {
         throw new deppPropelActAsBookmarkableException('Type can only be + or -');
     }
     if (is_null($user_id) or trim((string) $user_id) === '') {
         throw new deppPropelActAsBookmarkableException('Impossible to clear a user bookmarking with no user primary key provided');
     }
     $bookmarked_ids = array();
     $c = new Criteria();
     $c->add(sfBookmarkingPeer::USER_ID, $user_id);
     $c->add(sfBookmarkingPeer::BOOKMARKING, $type == '+' ? 1 : -1);
     $c->clearSelectColumns();
     $c->addSelectColumn(sfBookmarkingPeer::BOOKMARKABLE_MODEL);
     $c->addSelectColumn(sfBookmarkingPeer::BOOKMARKABLE_ID);
     $rs = sfBookmarkingPeer::doSelectRS($c);
     while ($rs->next()) {
         $key = $rs->getString(1);
         if (!array_key_exists($key, $bookmarked_ids)) {
             $bookmarked_ids[$key] = array();
         }
         array_push($bookmarked_ids[$key], $rs->getInt(2));
     }
     return $bookmarked_ids;
 }
Example #6
0
 /**
  * Get the email server accounts of the current workspace
  *     
  * return array
  */
 public function getEmailEventServerAccounts()
 {
     try {
         $criteria = new \Criteria("workflow");
         $criteria->clearSelectColumns();
         $criteria->addSelectColumn(\EmailServerPeer::MESS_UID);
         $criteria->addSelectColumn(\EmailServerPeer::MESS_FROM_MAIL);
         $criteria->addSelectColumn(\EmailServerPeer::MESS_ACCOUNT);
         $criteria->addAsColumn('UID', 'MESS_UID');
         $result = \EmailServerPeer::doSelectRS($criteria);
         $result->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         $result->next();
         $accountsArray = array();
         while ($aRow = $result->getRow()) {
             if ($aRow['MESS_UID'] != null) {
                 if($aRow['MESS_FROM_MAIL'] == "") {
                     $aRow['EMAIL'] = $aRow['MESS_ACCOUNT'];  
                 } else {
                     $aRow['EMAIL'] = $aRow['MESS_FROM_MAIL']; 
                 }
                 $accountsArray[] = array_change_key_case($aRow, CASE_LOWER);
             } 
             $result->next();
         }
         return $accountsArray;
     } catch (\Exception $e) {
         throw $e;
     }
 }
 public function getCalendarHolidays($CalendarUid)
 {
     $Criteria = new Criteria('workflow');
     $Criteria->clearSelectColumns();
     $Criteria->addSelectColumn(CalendarHolidaysPeer::CALENDAR_UID);
     $Criteria->addSelectColumn(CalendarHolidaysPeer::CALENDAR_HOLIDAY_NAME);
     $Criteria->addSelectColumn(CalendarHolidaysPeer::CALENDAR_HOLIDAY_START);
     $Criteria->addSelectColumn(CalendarHolidaysPeer::CALENDAR_HOLIDAY_END);
     $Criteria->add(CalendarHolidaysPeer::CALENDAR_UID, $CalendarUid, CRITERIA::EQUAL);
     $rs = CalendarHolidaysPeer::doSelectRS($Criteria);
     $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $rs->next();
     $row = $rs->getRow();
     $fields = array();
     $count = 0;
     while (is_array($row)) {
         $count++;
         $a = explode(" ", $row['CALENDAR_HOLIDAY_START']);
         $row['CALENDAR_HOLIDAY_START'] = $a[0];
         $a = explode(" ", $row['CALENDAR_HOLIDAY_END']);
         $row['CALENDAR_HOLIDAY_END'] = $a[0];
         $fields[$count] = $row;
         $rs->next();
         $row = $rs->getRow();
     }
     return $fields;
 }
Example #8
0
 public static function getEquipmentMileage($userId, $bikeId)
 {
     $c = new Criteria();
     $c->clearSelectColumns();
     $c->addSelectColumn('SUM(' . UserStatsPeer::MILEAGE . ')');
     $c->addSelectColumn(UserEquipementPeer::EQUIPMENT_ID);
     //$c->addGroupByColumn(UserRidesPeer::MILEAGE);
     $c->add(UserEquipementPeer::USER_ID, $userId);
     $c->add(UserEquipementPeer::BIKE_ID, $bikeId);
     $c->addJoin(UserEquipementPeer::EQUIPMENT_ID, UserStatEquipPeer::USER_EQUIP_ID, Criteria::INNER_JOIN);
     $c->addJoin(UserStatEquipPeer::USER_STAT_ID, UserStatsPeer::STAT_NO, Criteria::INNER_JOIN);
     //$c->addJoin(UserStatsPeer::RIDE_KEY,UserRidesPeer::USER_RIDE_ID, Criteria::INNER_JOIN);
     $c->addGroupByColumn(UserEquipementPeer::EQUIPMENT_ID);
     $stmt = UserStatsPeer::doSelectStmt($c);
     $hashmap = array();
     if ($stmt) {
         while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
             if ($row) {
                 $sum = $row[0];
                 $eqId = $row[1];
                 //echo 'Mil '.$sum.' '.$eqId;
                 $hashmap[$eqId] = $sum;
                 // array_push($hashmap, $eqId=>$sum);
             }
         }
     }
     return $hashmap;
 }
Example #9
0
 /**
  * Function getRolesBySystem
  * access public
  */
 function getRolesBySystem($SysUid, $UsrUid)
 {
     $con = Propel::getConnection(UsersRolesPeer::DATABASE_NAME);
     try {
         $c = new Criteria('rbac');
         $c->clearSelectColumns();
         $c->addSelectColumn(RolesPeer::ROL_UID);
         $c->addSelectColumn(RolesPeer::ROL_CODE);
         $c->addJoin(UsersRolesPeer::ROL_UID, RolesPeer::ROL_UID);
         $c->add(UsersRolesPeer::USR_UID, $UsrUid);
         $c->add(RolesPeer::ROL_SYSTEM, $SysUid);
         $rs = UsersRolesPeer::doSelectRs($c);
         $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $rs->next();
         $row = $rs->getRow();
         /*  return only the first row, no other rows can be permitted
             while ( is_array ( $row ) ) {
               $rows[] = $row;
               $rs->next();
               $row = $rs->getRow();
             }
             */
         return $row;
     } catch (Exception $oError) {
         throw $oError;
     }
 }
 /**
  * returns the groups in the given ramo (and for the given legislatura) and include the zero value, if given
  *
  * @param string $ramo 
  * @param int    $legislatura
  * @param string $include_zero 
  * @return an associative array, with id and name as key => value
  * @author Guglielmo Celata
  */
 public static function getAllGroups($ramo, $legislatura, $include_zero = false)
 {
     $c = new Criteria();
     if ($ramo == 'camera') {
         $c->add(OppCaricaPeer::TIPO_CARICA_ID, 1);
     } else {
         $c->add(OppCaricaPeer::TIPO_CARICA_ID, array(4, 5), Criteria::IN);
     }
     $c->addJoin(OppGruppoPeer::ID, OppCaricaHasGruppoPeer::GRUPPO_ID);
     $c->addJoin(OppCaricaPeer::ID, OppCaricaHasGruppoPeer::CARICA_ID);
     $c_or_leg = $c->getNewCriterion(OppCaricaPeer::LEGISLATURA, $legislatura);
     $c_or_leg->addOr($c->getNewCriterion(OppCaricaPeer::LEGISLATURA, null, Criteria::ISNULL));
     $c->add($c_or_leg);
     $c->clearSelectColumns();
     $c->addSelectColumn(OppGruppoPeer::ID);
     $c->addSelectColumn(OppGruppoPeer::NOME);
     $c->setDistinct();
     $rs = OppGruppoPeer::doSelectRS($c);
     if ($include_zero) {
         $all_groups = array('0' => $include_zero);
     } else {
         $all_groups = array();
     }
     while ($rs->next()) {
         $all_groups[$rs->getInt(1)] = $rs->getString(2);
     }
     return $all_groups;
 }
 public static function getAttoIdsByTag($tag_id)
 {
     $c = new Criteria();
     $c->add(self::TAG_ID, $tag_id);
     $c->clearSelectColumns();
     $c->addSelectColumn(self::ATTO_ID);
     return self::doSelectRS($c);
 }
Example #12
0
 public function getNotesList($appUid, $usrUid = '', $start = '', $limit = 25, $sort = 'APP_NOTES.NOTE_DATE', $dir = 'DESC', $dateFrom = '', $dateTo = '', $search = '')
 {
     $Criteria = new Criteria('workflow');
     $Criteria->clearSelectColumns();
     $Criteria->addSelectColumn(AppNotesPeer::APP_UID);
     $Criteria->addSelectColumn(AppNotesPeer::USR_UID);
     $Criteria->addSelectColumn(AppNotesPeer::NOTE_DATE);
     $Criteria->addSelectColumn(AppNotesPeer::NOTE_CONTENT);
     $Criteria->addSelectColumn(AppNotesPeer::NOTE_TYPE);
     $Criteria->addSelectColumn(AppNotesPeer::NOTE_AVAILABILITY);
     $Criteria->addSelectColumn(AppNotesPeer::NOTE_ORIGIN_OBJ);
     $Criteria->addSelectColumn(AppNotesPeer::NOTE_AFFECTED_OBJ1);
     $Criteria->addSelectColumn(AppNotesPeer::NOTE_AFFECTED_OBJ2);
     $Criteria->addSelectColumn(AppNotesPeer::NOTE_RECIPIENTS);
     $Criteria->addSelectColumn(UsersPeer::USR_USERNAME);
     $Criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
     $Criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
     $Criteria->addSelectColumn(UsersPeer::USR_EMAIL);
     $Criteria->addJoin(AppNotesPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
     $Criteria->add(AppNotesPeer::APP_UID, $appUid, Criteria::EQUAL);
     if ($usrUid != '') {
         $Criteria->add(AppNotesPeer::USR_UID, $usrUid, Criteria::EQUAL);
     }
     if ($dateFrom != '') {
         $Criteria->add(AppNotesPeer::NOTE_DATE, $dateFrom, Criteria::GREATER_EQUAL);
     }
     if ($dateTo != '') {
         $Criteria->add(AppNotesPeer::NOTE_DATE, $dateTo, Criteria::LESS_EQUAL);
     }
     if ($search != '') {
         $Criteria->add(AppNotesPeer::NOTE_CONTENT, '%' . $search . '%', Criteria::LIKE);
     }
     if ($dir == 'DESC') {
         $Criteria->addDescendingOrderByColumn($sort);
     } else {
         $Criteria->addAscendingOrderByColumn($sort);
     }
     $response = array();
     $totalCount = AppNotesPeer::doCount($Criteria);
     $response['totalCount'] = $totalCount;
     $response['notes'] = array();
     if ($start != '') {
         $Criteria->setLimit($limit);
         $Criteria->setOffset($start);
     }
     $oDataset = appNotesPeer::doSelectRS($Criteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     while ($aRow = $oDataset->getRow()) {
         $aRow['NOTE_CONTENT'] = htmlentities(stripslashes($aRow['NOTE_CONTENT']), ENT_QUOTES, 'UTF-8');
         $response['notes'][] = $aRow;
         $oDataset->next();
     }
     $result['criteria'] = $Criteria;
     $result['array'] = $response;
     return $result;
 }
Example #13
0
 /**
  * 
  * @return Routes2011[]
  */
 public static function getAllDistinctRouteId()
 {
     $criteria = new Criteria();
     $criteria->addAscendingOrderByColumn(self::ROUTEID);
     $criteria->setDistinct();
     $criteria->clearSelectColumns();
     $criteria->addSelectColumn(self::ROUTEID);
     return self::doSelect($criteria);
 }
 /**
  * Returns all credentials (permission names) for the role given
  */
 public static function retrieveAllCredentialsForARole($role)
 {
     $c = new Criteria();
     $c->add(sfGuardGroupPermissionPeer::GROUP_ID, $role->getId());
     $c->addJoin(sfGuardGroupPermissionPeer::PERMISSION_ID, self::ID);
     $c->clearSelectColumns();
     $c->addSelectColumn(self::NAME);
     $stmt = self::doSelectStmt($c);
     return $stmt->fetchAll(PDO::FETCH_COLUMN);
 }
 /**
  * description
  *
  * @return return_type
  * @param  var_type $var
  */
 public static function getPropertyNames()
 {
     $c = new Criteria();
     $c->clearSelectColumns()->addSelectColumn(SkosPropertyPeer::ID);
     $c->addSelectColumn(self::NAME);
     $rs = SkosPropertyPeer::doSelectRS($c);
     while ($rs->next()) {
         $results[$rs->getString(2)] = $rs->getInt(1);
     }
     return $results;
 }
/**
* Check and remove news related to non-existing objects
*/
function run_opp_news_clean($task, $args)
{
    static $loaded;
    // load application context
    if (!$loaded) {
        define('SF_ROOT_DIR', sfConfig::get('sf_root_dir'));
        define('SF_APP', 'fe');
        define('SF_ENVIRONMENT', 'task');
        define('SF_DEBUG', true);
        require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
        sfContext::getInstance();
        sfConfig::set('pake', true);
        error_reporting(E_ALL);
        $loaded = true;
    }
    $start_time = microtime(true);
    $c = new Criteria();
    $c->clearSelectColumns();
    $c->addSelectColumn(NewsPeer::ID);
    $c->addSelectColumn(NewsPeer::RELATED_MONITORABLE_MODEL);
    $c->addSelectColumn(NewsPeer::RELATED_MONITORABLE_ID);
    $n_news = NewsPeer::doCount($c);
    $rs = NewsPeer::doSelectRS($c);
    $k = 0;
    $newsids_to_remove = array();
    $removed_news = 0;
    while ($rs->next()) {
        $news = array();
        $news['id'] = $rs->getInt(1);
        $news['rel_model'] = $rs->getString(2);
        $news['rel_id'] = $rs->getInt(3);
        if (opp_check_single_news($news)) {
            $newsids_to_remove[] = $news['id'];
            $removed_news++;
        }
        $k++;
        if ($k % 100 == 0) {
            print ".";
        }
        if ($k > 0 && $k % 1000 == 0) {
            $rem = count($newsids_to_remove);
            NewsPeer::doDelete($newsids_to_remove);
            print "processed: {$k}/{$n_news} removed: {$rem} ({$removed_news})\n";
            $newsids_to_remove = array();
        }
    }
    $total_time = microtime(true) - $start_time;
    echo pakeColor::colorize('All done! ', array('fg' => 'red', 'bold' => true));
    echo 'Processed ';
    echo pakeColor::colorize(count($n_news), array('fg' => 'cyan'));
    echo ' news in ';
    echo pakeColor::colorize(sprintf("%f", $total_time), array('fg' => 'cyan'));
    echo " seconds\n";
}
  /**
   * Get all the different values set to $column.
   *
   * @param  string    $column The column from this class' table.
   * @param  PropelPDO $con    Optional PDO object.
   * @return array
   */
  static public function retrieveAllValuesForColumn($column, PropelPDO $con = null)
  {
    $criteria = new Criteria();

    $criteria->setDistinct();
    $criteria->clearSelectColumns();
    $criteria->addSelectColumn($column);

    return ncTrackerEntryPeer::doSelectStmt($criteria)
      ->fetchAll(PDO::FETCH_COLUMN);
  }
Example #18
0
 public function getHostnames($value = '')
 {
     $criteria = new Criteria();
     $criteria->clearSelectColumns();
     $criteria->addSelectColumn(self::HOSTNAME);
     $criteria->setDistinct();
     $stmt = self::doSelectStmt($criteria);
     while ($host = $stmt->fetchColumn(0)) {
         $results[] = $host;
     }
     return $results;
 }
 public function getTagsAsString()
 {
     $c = new Criteria();
     $c->clearSelectColumns()->clearOrderByColumns();
     $c->addSelectColumn(sfSimpleBlogTagPeer::TAG);
     $c->add(sfSimpleBlogTagPeer::SF_BLOG_POST_ID, $this->getId());
     $rs = sfSimpleBlogPostPeer::doSelectRS($c);
     $tags = array();
     while ($rs->next()) {
         $tags[] = $rs->getString(1);
     }
     return implode($tags, ',');
 }
 protected static function getAllNamespaces()
 {
     $c = new Criteria();
     $c->clearSelectColumns();
     $c->addSelectColumn(self::LAUNCH_NAMESPACE);
     $c->setDistinct();
     $rs = self::doSelectRS($c);
     $namespaces = array();
     while ($rs->next()) {
         $namespaces[] = $rs->getString(1);
     }
     return $namespaces;
 }
 public function loadByCategoryId($sCategoryUid)
 {
     $c = new Criteria('workflow');
     $del = DBAdapter::getStringDelimiter();
     $c->clearSelectColumns();
     $c->addSelectColumn(ProcessCategoryPeer::CATEGORY_NAME);
     $c->add(ProcessCategoryPeer::CATEGORY_UID, $sCategoryUid);
     $dataset = ProcessCategoryPeer::doSelectRS($c);
     $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $dataset->next();
     $aRow = $dataset->getRow();
     return $aRow['CATEGORY_NAME'];
 }
Example #22
0
 public static function getLodging($name, $passenger_id)
 {
     $c = new Criteria();
     $c->addJoin(self::PASSENGER_ID, PassengerPeer::ID, Criteria::INNER_JOIN);
     $c->add(self::PASSENGER_ID, $passenger_id);
     $name = mysql_escape_string($name);
     $c->clearSelectColumns();
     $c->addSelectColumn(self::LODGING);
     $c->add(self::LODGING, '%' . $name . '%', Criteria::LIKE);
     $c->setDistinct();
     $c->setLimit(10);
     return self::doSelectStmt($c);
 }
 /**
  * description
  *
  * @return ProfileProperty[]
  */
 public static function getPropertyNames()
 {
     $results = false;
     $c = new Criteria();
     $c->clearSelectColumns()->addSelectColumn(self::SKOS_ID);
     $c->add(self::PROFILE_ID, 2);
     $c->addSelectColumn(self::NAME);
     $rs = self::doSelectRS($c);
     while ($rs->next()) {
         $results[$rs->getString(2)] = $rs->getInt(1);
     }
     return $results;
 }
Example #24
0
 public function getConfigs()
 {
     $c = new Criteria();
     $c->clearSelectColumns();
     $c->addSelectColumn('MAX(' . SchedulerConfigPeer::ID . ')');
     $c->addGroupByColumn(SchedulerConfigPeer::VARIABLE);
     $c->addGroupByColumn(SchedulerConfigPeer::VARIABLE_PART);
     $c->addAscendingOrderByColumn(SchedulerConfigPeer::VARIABLE);
     $c->add(SchedulerConfigPeer::SCHEDULER_ID, $this->id);
     $c->add(SchedulerConfigPeer::WORKER_ID, null);
     $rs = SchedulerConfigPeer::doSelectStmt($c, myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2));
     $configIds = $rs->fetchAll(PDO::FETCH_COLUMN, 0);
     return SchedulerConfigPeer::retrieveByPKs($configIds, myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2));
 }
Example #25
0
 /**
  * Get the evn_description column value.
  *
  * @return string
  */
 public function loadDefaultAccount()
 {
     $c = new Criteria('workflow');
     $del = DBAdapter::getStringDelimiter();
     $c->clearSelectColumns();
     $c->addSelectColumn(EmailServerPeer::MESS_ACCOUNT);
     $c->add(EmailServerPeer::MESS_DEFAULT, 1);
     $rs = EmailServerPeer::doSelectRS($c, Propel::getDBConnection('workflow_ro'));
     $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $rs->next();
     $row = $rs->getRow();
     $response = $row;
     return $response;
 }
 public function getPositionInTopic()
 {
     $c = new Criteria();
     $c->clearSelectColumns();
     $c->addSelectColumn(sfSimpleForumPostPeer::ID);
     $c->add(sfSimpleForumPostPeer::TOPIC_ID, $this->getTopicId());
     $c->addAscendingOrderByColumn(sfSimpleForumPostPeer::CREATED_AT);
     $rs = sfSimpleForumPostPeer::doSelectRS($c);
     $messages = array();
     while ($rs->next()) {
         $messages[] = $rs->getInt(1);
     }
     return array_search($this->getId(), $messages);
 }
 /**
  * Check if an Object has been launched with any namespace
  *
  * @param  BaseObject  $object
  * @throws deppPropelActAsLaunchableException
  * @return Array of namespaces where the object was launched
  **/
 public function hasBeenLaunched(BaseObject $object)
 {
     $c = new Criteria();
     $c->add(sfLaunchingPeer::OBJECT_ID, $object->getPrimaryKey());
     $c->add(sfLaunchingPeer::OBJECT_MODEL, get_class($object));
     $c->clearSelectColumns();
     $c->addSelectColumn(sfLaunchingPeer::LAUNCH_NAMESPACE);
     $rs = sfLaunchingPeer::doSelectRS($c);
     $launches = array();
     while ($rs->next()) {
         $launches[] = $rs->getString(1);
     }
     return $launches;
 }
 public static function getTagsWithCount()
 {
     $c = new Criteria();
     $c->clearSelectColumns()->clearOrderByColumns();
     $c->addSelectColumn(self::TAG);
     $c->addSelectColumn('count(' . self::SF_BLOG_POST_ID . ') as count');
     $c->addGroupByColumn(self::TAG);
     $rs = self::doSelectRS($c);
     $tags = array();
     while ($rs->next()) {
         $tags[] = array($rs->getString(1), $rs->getInt(2));
     }
     return $tags;
 }
Example #29
0
 /**
  * Return case scheduler of a project
  * @param string $sProcessUID
  * @param string $sCaseSchedulerUID
  * @return array
  *
  * @access public
  */
 public function getCaseScheduler($sProcessUID = '', $sCaseSchedulerUID = '')
 {
     try {
         $oCaseSchedulerTest = \CaseSchedulerPeer::retrieveByPK($sCaseSchedulerUID);
         if (is_null($oCaseSchedulerTest)) {
             throw new \Exception(\G::LoadTranslation("ID_CASE_SCHEDULER_DOES_NOT_EXIST", array($sCaseSchedulerUID)));
         }
         $oCriteria = new \Criteria('workflow');
         $oCriteria->clearSelectColumns();
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::SCH_UID);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::SCH_NAME);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::SCH_DEL_USER_NAME);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::SCH_DEL_USER_UID);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::PRO_UID);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::TAS_UID);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::SCH_TIME_NEXT_RUN);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::SCH_LAST_RUN_TIME);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::SCH_STATE);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::SCH_LAST_STATE);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::USR_UID);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::SCH_OPTION);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::SCH_START_TIME);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::SCH_START_DATE);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::SCH_DAYS_PERFORM_TASK);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::SCH_EVERY_DAYS);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::SCH_WEEK_DAYS);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::SCH_START_DAY);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::SCH_MONTHS);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::SCH_END_DATE);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::SCH_REPEAT_EVERY);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::SCH_REPEAT_UNTIL);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::SCH_REPEAT_STOP_IF_RUNNING);
         $oCriteria->addSelectColumn(\CaseSchedulerPeer::CASE_SH_PLUGIN_UID);
         $oCriteria->add(\CaseSchedulerPeer::PRO_UID, $sProcessUID);
         $oCriteria->add(\CaseSchedulerPeer::SCH_UID, $sCaseSchedulerUID);
         $oDataset = \CaseSchedulerPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         $aRows = array();
         while ($aRow = $oDataset->getRow()) {
             $aRow = array_change_key_case($aRow, CASE_LOWER);
             $aRows = $aRow;
             $oDataset->next();
         }
         return $aRows;
     } catch (Exception $e) {
         throw $e;
     }
 }
 /**
  * gets a list of all agents related to all schemas
  *
  * @return array Agents
  * @param  var_type $var
  */
 public static function getSchemaAgents()
 {
     $results = array();
     $c = new Criteria();
     $c->clearSelectColumns();
     $c->addSelectColumn(self::AGENT_ID);
     $c->addJoin(self::AGENT_ID, AgentPeer::ID);
     $c->addAscendingOrderByColumn(AgentPeer::ORG_NAME);
     $c->setDistinct();
     $rs = self::doSelectRS($c);
     while ($rs->next()) {
         $results[] = AgentPeer::retrieveByPK($rs->getInt(1));
     }
     return $results;
 }