コード例 #1
0
 function getTwitterAccounts()
 {
     $object = new CRM_CiviruleTwitter_BAO_TwitterAccount();
     $object->find();
     $return = array();
     while ($object->fetch()) {
         $return[$object->id] = '@' . $object->twitter_name . ' - ' . $object->description;
     }
     return $return;
 }
コード例 #2
0
 /**
  * Takes a bunch of params that are needed to match certain criteria and
  * retrieves the relevant objects. Typically the valid params are only
  * contact_id. We'll tweak this function to be more full featured over a period
  * of time. This is the inverse function of create. It also stores all the retrieved
  * values in the default array
  *
  * @param array $params   (reference ) an assoc array of name/value pairs
  * @param array $defaults (reference ) an assoc array to hold the flattened values
  * @return CRM_CiviruleTwitter_BAO_TwitterAccount
  *
  * @access public
  * @static
  */
 static function retrieve(&$params, &$defaults)
 {
     $twitterAccount = new CRM_CiviruleTwitter_BAO_TwitterAccount();
     $twitterAccount->copyValues($params);
     if ($twitterAccount->find(true)) {
         CRM_Core_DAO::storeValues($twitterAccount, $defaults);
         return $twitterAccount;
     }
     return null;
 }
コード例 #3
0
 /**
  * Returns a user friendly text explaining the condition params
  * e.g. 'Older than 65'
  *
  * @return string
  * @access public
  */
 public function userFriendlyConditionParams()
 {
     $params = $this->getActionParameters();
     $account = ts('Unknown');
     $twitter_account = new CRM_CiviruleTwitter_BAO_TwitterAccount();
     $twitter_account->id = $params['twitter_account'];
     if ($twitter_account->find(true)) {
         $description = '';
         if ($twitter_account->description) {
             $description = ' "' . $twitter_account->description . '"';
         }
         $account = '@' . $twitter_account->twitter_name . ' ' . $description;
     }
     return sprintf('Tweet: "%s" %s', $params['status'], $account);
 }