Example #1
0
 /**
  * ให้ค่า url สำหรับเรียกใช้งาน  document
  * @return string
  */
 public function getPublishUri($options = array())
 {
     $encodeId = $this->refId;
     if (is_numeric($this->refId)) {
         $encodeId = strpos($this->refId, '.') ? strval($this->refId) : intval($this->refId);
     }
     $params = array(self::ENCODE_ENTITY => (int) $this->type, self::ENCODE_ID => $encodeId, self::ENCODE_ITEMNO => (int) $this->itemNo) + $options;
     $enc = new TrEnc(\Yii::$app->params['crypto'][0][0], \Yii::$app->params['crypto'][0][1]);
     $arr = explode(".", $this->fileName);
     $extension = $arr[count($arr) - 1];
     $retVal = $enc->encode($params) . '.' . $extension;
     return $retVal;
 }