Documentation

Documentor Guide

Template building

Templates located under /public/templates/{template_id} folder.
Template folder has free structure, but should contain some necessary pages according to existing page types:
page.phtml
asset.phtml
agents.phtml
list.phtml
post.phtml

Module

Site module can be rendered by adding shortcode to page content.

['youtube' url=https://www.youtube.com/embed/1gCulUDvALM size=medium]
['twitter' url=google.com]

First parameter is required and it's contains module name. Should be inside quotes.
Other parameters are module options like url, size, data, etc.

!!! Module will not render if not exists in site_modules table or not defined on template level !!!

Module Front Assets

Module assets should be defined under public/siteModules/{module_name} folder.
Entire folder structure should be defined as below:
{module_name}/assets
{module_name}/js
{module_name}/css

Including front files in module code example:

$this->_modulesWwwDir.'{module_name}/js/main.js'

Module backend

Module backend files located under library/SiteModules/{module_name} folder.
Each module should contain file equal to module name. This file should contain class with same name as module name.
Basic module class example.

class youtube extends Zend_Controller_Action_Helper_Module
{


    public function __construct()
    {
        parent::__construct();
    }

    public function render ($moduleOptions = array()){

        appendHeadFile($this->_modulesWwwDir.'youtube/js/main.js');
        appendFooterScript($this->_modulesWwwDir.'youtube/js/footer.js');
        appendHeadLink($this->_modulesWwwDir.'youtube/css/main.css');

        $module = '<div class="youtube" align = "center"><h2>Youtube module:</h2><p>Parameters:</p><p> url => '. $moduleOptions['url'] .'</p><p>size => '. $moduleOptions['size'] .'</p><div class="video-container"><iframe src="'. $moduleOptions['url'] .'" frameborder="0" width="560" height="315"></iframe></div><h2>Youtube module end</h2>';

        return $module; 
    }

}

Method "render()" will be called by module resolver.
"moduleOptions" will contain module parameters from shortcode.
Call to parent constructor required in order to inherit parent properties like "_modulesDir" or "_modulesWwwDir"

Global functions to use in templates

Global functions are defined on system level and can be called from any place.

appendHeadScript($script) - add js script to head section (requires <?php echo $this->headScript() ?>  in head section)

appendHeadFile($filePath) - add js script file to head section (requires <?php echo $this->headScript() ?>  in head section)

appendHeadLink($cssPath) - add css  file to head section (requires <?php echo $this->headLink() ?>  in head section)

appendFooterScript($script) - add js script file to footer section (requires <?php echo $this->placeholder('footerScript'); ?> in footer section)

 

Get Assets

Description
The most appropriate use for get_assets is to create an array of posts based on a set of parameters. It retrieves a list of assets.

Default Usage

<?php 
$args = array(
                'limit'            => '5',
        'offset'           => '0',
        'contractType'    => '',
        'assetType'       => '',
        'country'          => 'Israel',
        'city'             => 'Tel Aviv-Yafo',
        'orderBy'          => 'contract_type',
        'order'            => '',
        'features'          =>'',
        'assetStatus'     => '',
        'exclusivity'      => '0',
);
$assets_array = getAssets( $args );
?>

Parameters
'orderBy'
(string) (optional) Sort retrieved posts by parameter.
Default: 'date'

'id' - Order by asset id.
'title' - Order by title.
'last_update_date' - Order by last modified date.

offset
(integer) The number of assets to pass over (or displace) before collecting the set of assets. Default is no OFFSET.

contract_type
("string") Show posts associated with certain type. (example: 'contract_type="sales"').

asset_type
("string") Show posts associated with certain type. (example: 'asset_type="villa"').

country
("string") Show posts associated with certain country. (example: 'country="France"').

city
("string") Show posts associated with certain city. (example: 'city="Paris"').

asset_status
(string) asset status types that should be included.

Return
(Array)
An array containing all the Assets matching the request, or false on failure. The returned array is an array of "asset" arrays.

Get Assets Types

Description
Retrieves all assets types.

Default Usage

<?php 
$args = array(
    'orderby'       => 'name',
    'order'         => 'DESC',
);
$assetassetType = get_asset_asset_type( $args );
?>

Parameters
'orderby'
(string) Field by which results should be sorted. Accepts 'name', 'id', 'slug', 'count'. Default 'name'.

'order'
(string) Sort order. Accepts 'ASC' or 'DESC'. Default 'ASC'.

Return
(array) List of asset types.

ID: asset type ID (int)
asset_type_name
asset_type_slug
asset_type_count: (int) the number of uses of this asset type

Get Asset

Description
Retrieves asset data given a asset ID or asset object.

Default Usage

<?php $asset = getAsset( $asset_id); ?>

'asset_id'
(int) asset ID

Return
(Array)
An array containing all the Assets matching the request, or empty on failure.

Get aAsset Agent

Description
Retrieves assets agent from an asset ID.

Default Usage

<?php $assetAgent = get_asset_agent( $asset_id ); ?>

Parameters
'asset_id'
(int) asset ID

Return
(array|object) List of given asset agent params.

ID: agent ID (int)
agent_name
agent_email
agent_description: HTML (string)
agent_office_phone
agent_mobile_phone
agent_fax
agent_slug
agent_social (array) (key, value) eg. facebook=> facebook_url

Get Asset Contract Type

Description
Retrieves assets contract type from an asset ID.

Default Usage

<?php $assetContractType = getAssetContractType( $asset_id ); ?>

'asset_id'
(string) asset ID

Return
(string) Asset contract type.

Get Asset Count

Description
Retrieves the number of assets.

Default Usage

<?php 
$args = array(
    'contract_type'    => '',
    'asset_type'       => '',
    'country'          => '',
    'city'             => '',
    'include'          => '',
    'exclude'          => '',
    'agent_id'          => '',
    'agent_name'       => '',
    'features'          =>'''
    'asset_status'     => '',
    'contract_status'  => '', // need to be added
    'exclusivity'      => 'false',
);
$AssetCount = get_asset_count( $args )
?>

Parameters
contract_type
("string") Show posts associated with certain type. (example: 'contract_type="sales"').

asset_type
("string") Show posts associated with certain type. (example: 'asset_type="villa"').

country
("string") Show posts associated with certain country. (example: 'country="France"').

city
("string") Show posts associated with certain city. (example: 'city="Paris"').

asset_status
(boolean) asset status types that should be included. Valid values:
true - default
false

contract_status
(boolean) asset status types that should be included. Valid values:
true - default
false

exclude
(string or array) Define a comma-separated list of Assets IDs to be excluded from the list (example: 'exclude=3,7,31').

include
(string or array) Only include certain Assetss in the list generated by get_assets. Like exclude, this parameter takes a comma-separated list of Assets IDs.

features
(string or array) Only include the Assets that have this features values set to 1 (example: 'features=conditioning,Balcony,Bedding').

agent_id
(string) Only include the Assets associated to the given agent ID

agent_name
(string) Only include the Assets associated to the given agent name

Return
count: number of assets (int)

Get Asset Features

Description
Retrieves assets features from an asset ID.

Default Usage

<?php 
$assetFeatures = getAssetFeatures( $asset_id );
?>

Parameters
$asset_id
(int) Asset ID

Return
(array) List of given asset feature.

Get Asset Images

Description
Retrieves asset images from an asset ID.

Default Usage

<?php $asset = get_asset_thumbnails( $asset = '' , $size = 'thumbnail'); ?>

Parameters
$asset
(int) asset ID

$size
(string|array) (Optional) Image size to use. Accepts any valid image size, or an array of width and height values in pixels (in that order).
Default value: 'thumbnail'
Valid values:
'thumbnail' // Thumbnail (Note: different to asset Thumbnail)
'medium' // Medium resolution
'large' // Large resolution
'full' // Original resolution
array(100, 100) // Other resolutions

Return
(array) The asset images URLs.

Get Asset Tags

Description
Retrieves assets tags from an asset ID.

Default Usage

<?php 
$args = array(
    'orderby'       => 'name',
    'order'         => 'DESC',
);
$assetTags = get_asset_tags( $asset_id, $args );
?>

Parameters
$asset_id
(int) Asset ID

'orderby'
(string) Field by which results should be sorted. Accepts 'name', 'id', 'slug','count'. Default 'name'.

'order'
(string) Sort order. Accepts 'ASC' or 'DESC'. Default 'ASC'.

Return
(array) List of given asset tag.

ID: tag ID (int)
tag_name
tag_slug
tag_count (int) the number of uses of this tag

Get Asset Type

Description
Retrieves asset type from an asset ID.

Default Usage

<?php $assetType = getAssetTypes( $asset_id ); ?>

Parameters
$asset_id
(int) Asset ID

Return
(array) asset types.

Responce Example
array(2) {
[1] => string(10) "Appartment"
[2] => string(4) "Flat"
}

Get Agents

Description
Retrieves assets agents from an asset ID.

Default Usage

<?php 
$args = array(
    'orderby'       => 'name',
    'order'         => 'DESC',
);
$assetAgents = get_asset_agents( $asset_id, $args );
?>

Parameters
$asset_id
(int) Asset ID

'orderby'
(string) Field by which results should be sorted. Accepts 'name', 'id', 'slug','count'. Default 'name'.

'order'
(string) Sort order. Accepts 'ASC' or 'DESC'. Default 'ASC'.

Return
(array) List of given asset agent.

ID: agent ID (int)
agent_name
agent_email
agent_description: HTML (string)
agent_office_phone
agent_mobile_phone
agent_fax
agent_slug
agent_social: (array) (key, value) eg. facebook=> facebook_url

Get Agent Assets

Description
Retrieves a list of assets according to the given agent.

Default Usage

<?php 
$args = array(
    'assets_per_page'  => 5,
    'offset'           => 0,
    'contract_type'    => '',
    'asset_type'       => '',
    'country'          => '',
    'city'             => '',
    'orderby'          => 'date',
    'order'            => 'DESC',
    'include'          => '',
    'exclude'          => '',
    'agent_id'          => '',
    'agent_name'       => '',
    'features'          =>'''
    'asset_status'     => '',
    'contract_status'  => '', // need to be added
    'exclusivity'      => 'false',
);
$assets_array = get_assets($agent_id, $args );
?>

Parameters
orderby
(string) (optional) Sort retrieved posts by parameter.
Default: 'date'

'none' - No order 
'ID' - Order by post id. Note the capitalization.
'agent' - Order by agent.
'title' - Order by title.
'date' - Order by date.
'modified' - Order by last modified date.
'rand' - Random order.
'asset__in' - Matches same order you passed in via the 'include' parameter.

offset
(integer) The number of assets to pass over (or displace) before collecting the set of assets. Default is no OFFSET.

contract_type
("string") Show posts associated with certain type. (example: 'contract_type="sales"').

asset_type
("string") Show posts associated with certain type. (example: 'asset_type="villa"').

country
("string") Show posts associated with certain country. (example: 'country="France"').

city
("string") Show posts associated with certain city. (example: 'city="Paris"').

asset_status
(boolean) asset status types that should be included. Valid values:
true - default
false

contract_status
(boolean) asset status types that should be included. Valid values:
true - default
false

exclude
(string or array) Define a comma-separated list of Assets IDs to be excluded from the list (example: 'exclude=3,7,31').

include
(string or array) Only include certain Assetss in the list generated by get_assets. Like exclude, this parameter takes a comma-separated list of Assets IDs.

features
(string or array) Only include the Assets that have this features values set to 1 (example: 'features=conditioning,Balcony,Bedding').

agent_id
(string) Only include the Assets associated to the given agent ID

agent_name
(string) Only include the Assets associated to the given agent name

Return
(Array)
An array containing all the Assets matching the request, or false on failure. The returned array is an array of "asset" objects. Each asset object is a map containing 28 keys:
ID: asset ID (int)
asset_agent: agent ID (string)
asset_ref: asset reference (string)
asset_date: creation date - time-date string (YYYY-MM-DD HH:MM:SS), e.g., "2012-10-15 01:02:59"
asset_modified: last update date - time-date string (YYYY-MM-DD HH:MM:SS), e.g., "2012-10-15 01:02:59"
asset_date_gmt: time-date string
asset_description: HTML (string)
asset_title
asset_price
asset_rooms
asset_floor
asset_surface
asset_country
asset_city
asset_district
asset_street
asset_number
asset_images: URLs (array)
asset_video: url
asset_orientation: (array)
asset_type: (villa|penthouse|...)
asset_status: (active, inactive)
contract_status: (true|false)
exclusivity: (true|false)
asset_name: slug for asset
asset_link: URL
contract_type: (rent|sale|sasonal|...)
asset_features: array (key|value) eg, conditioning => 1

Get Agent Assets Count

Description
Retrieves the number of assets for a given agent ID.

Default Usage

<?php $agentAssetCount = get_agent_asset_count( $agent_id ); ?>

Parameters
$agent_id
(int) Agent ID

Return
count: number of assets (int)

Get Pages

Description
This function returns an array of pages that are in the blog, optionally constrained by parameters.

Default Usage

<?php 
$args = array(
    'pages_per_page'    => 5,
    'offset'            => 0,
    'orderby'           => 'date',
    'order'             => 'DESC',
    'include'           => '',
    'exclude'           => '',
    'page_status'       => 'active',
);
$pages_array = get_pages( $args );
?>

Parameters
'orderby'
(string) (optional) Sort retrieved posts by parameter.
Default: 'date'

'none' - No order 
'ID' - Order by post id. Note the capitalization.
'title' - Order by title.
'date' - Order by date.
'modified' - Order by last modified date.
'rand' - Random order.
'page__in' - Matches same order you passed in via the 'include' parameter.

offset
(integer) The number of pages to pass over (or displace) before collecting the set of pages. Default is no OFFSET.

page_status
(boolean) page status types that should be included. Valid values:
true - default
false

exclude
(string or array) Define a comma-separated list of pages IDs to be excluded from the list (example: 'exclude=3,7,31').

include
(string or array) Only include certain pagess in the list generated by get_pages. Like exclude, this parameter takes a comma-separated list of pages IDs.

Return
(Array)
An array containing all the pages matching the request, or false on failure. The returned array is an array of "page" objects. Each page object is a map containing 24 keys:
ID: page ID (int)
page_date: creation date - time-date string (YYYY-MM-DD HH:MM:SS), e.g., "2012-10-15 01:02:59"
page_modified: last update date - time-date string (YYYY-MM-DD HH:MM:SS), e.g., "2012-10-15 01:02:59"
page_date_gmt: time-date string
page_content: HTML (string)
page_title
page_excerpt: HTML (string)
page_status: (active, inactive)
page_name: slug for page
page_link: URL