[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Vtiger/models/ -> JsScript.php (source)

   1  <?php
   2  /*+***********************************************************************************
   3   * The contents of this file are subject to the vtiger CRM Public License Version 1.0
   4   * ("License"); You may not use this file except in compliance with the License
   5   * The Original Code is:  vtiger CRM Open Source
   6   * The Initial Developer of the Original Code is vtiger.
   7   * Portions created by vtiger are Copyright (C) vtiger.
   8   * All Rights Reserved.
   9   *************************************************************************************/
  10  
  11  /**
  12   * Vtiger JS Script Model Class
  13   */
  14  class Vtiger_JsScript_Model extends Vtiger_Base_Model {
  15  
  16      const DEFAULT_TYPE = 'text/javascript';
  17  
  18      /**
  19       * Function to get the type attribute value
  20       * @return <String>
  21       */
  22  	public function getType() {
  23          $type = $this->get('type');
  24          if(empty($type)){
  25              $type = self::DEFAULT_TYPE;
  26          }
  27          return $type;
  28      }
  29  
  30      /**
  31       * Function to get the src attribute value
  32       * @return <String>
  33       */
  34  	public function getSrc() {
  35          $src = $this->get('src');
  36          if(empty($src)) {
  37              $src = $this->get('linkurl');
  38          }
  39          return $src;
  40      }
  41  
  42      /**
  43       * Static Function to get an instance of Vtiger JsScript Model from a given Vtiger_Link object
  44       * @param Vtiger_Link $linkObj
  45       * @return Vtiger_JsScript_Model instance
  46       */
  47  	public static function getInstanceFromLinkObject (Vtiger_Link $linkObj){
  48          $objectProperties = get_object_vars($linkObj);
  49          $linkModel = new self();
  50          foreach($objectProperties as $properName=>$propertyValue){
  51              $linkModel->$properName = $propertyValue;
  52          }
  53          return $linkModel->setData($objectProperties);
  54      }
  55  }


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1