/**
  * create a new instance
  * 
  * @param mixed     $_data
  * @param string    $_keyFieldRecordModel
  * @return          Tinebase_Config_KeyField 
  */
 public static function create($_data, array $_options = array())
 {
     $record = new self();
     if (isset($_options['recordModel'])) {
         $record->setKeyFieldRecordModel($_options['recordModel']);
     }
     $record->setFromArray($_data);
     return $record;
 }
 /**
  * create a new instance
  * 
  * @param mixed     $_data
  * @param array     $_options
  * @return          Tinebase_Config_KeyField 
  */
 public static function create($_data, array $_options = array())
 {
     $record = new self();
     if (isset($_options['appName'])) {
         $record->setAppName($_options['appName']);
     }
     if (isset($_options['recordModel'])) {
         $record->setKeyFieldRecordModel($_options['recordModel']);
     }
     if (is_array($_data)) {
         $record->setFromArray($_data);
     } else {
         if (is_string($_data)) {
             if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) {
                 Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ . ' Did not get an array to set keyfield config. Got this: ' . $_data);
             }
         }
     }
     return $record;
 }
Example #3
0
    /**
     * Search
     *
     * @param string $query
     * @param integer $offset
     * @param integer $limit
     * @param string $scope
     * @return Zym_Service_Scribd_Search_Result
     */
    public function search($query, $offset, $limit = null, $scope = null)
    {
        $options = array(
            'query' => $query,
            'num_start' => $offset
        );

        if ($limit !== null) {
            $options['num_results'] = $limit;
        }

        if ($scope !== null) {
            $options['scope'] = $scope;
        }

        $response = $this->_restGet(
        	'docs.search',
            $options
        );

        $return = array();

        $list = (array) $this->_simpleXmlToArray($response->result_set);
        if (isset($list['result']['doc_id'])) {

            // So one exists
            if (isset($response->result_set->result)) {
                $doc      = new self();
                $doc->setScribdClient($this->getScribdClient());

        	    $return[] = $doc->setFromArray($list['result']);
            }
        } else if (is_array($list)) {
            foreach ($list as $results) {
                foreach ($results as $result) {
                    $doc      = new self();
                    $doc->setScribdClient($this->getScribdClient());

            	    $return[] = $doc->setFromArray($result);
                }
            }
        }

        /**
         * @see Zym_Service_Scribd_Search_Result
         */
        require_once 'Zym/Service/Scribd/Search/Result.php';
        $results = new Zym_Service_Scribd_Search_Result(
            $return,
            (int)$response->result_set['totalResultsAvailable'],
            (int)$response->result_set['firstResultPosition']
        );

        return $results;
    }
Example #4
0
File: Morm.php Project: anicet/morm
 public function getSame()
 {
     $morm = new self();
     $values = $this->_fields;
     if (is_array($this->_pkey)) {
         foreach ($this->_pkey as $value) {
             unset($values[$value]);
         }
     } else {
         unset($values[$this->_pkey]);
     }
     $morm->setFromArray($values);
     return $morm;
 }
Example #5
0
 /**
  * @see RGBColor::setFromArray
  *
  * @codeCoverageIgnore
  */
 public static function fromArray(array $array)
 {
     $color = new self();
     return $color->setFromArray($array);
 }
Example #6
0
	/**
	 * Create a new log entry populated with the standard information.
	 *
	 * @return SystemLogModel
	 */
	public static function Factory() {
		$log = new self();
		$log->setFromArray(
			array(
				'session_id' => session_id(),
				'user_id' => (\Core\user() ? \Core\user()->get('id') : 0),
				'ip_addr' => REMOTE_IP,
				'useragent' => isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '',
			)
		);

		return $log;
	}