Exemple #1
0
 public function getChannel($chnid)
 {
     if (!isset($this->channels[$chnid])) {
         LuLu::info('channel id:' . $chnid . ' does not exist');
         throw new InvalidParamException('channel id:' . $chnid . ' does not exist');
     }
     return $this->channels[$chnid];
 }
Exemple #2
0
 public static function exist($path)
 {
     if (is_array($path)) {
         $path = self::buildPath($path);
     }
     LuLu::info($path);
     return file_exists($path);
 }
Exemple #3
0
 private function checkName($value)
 {
     LuLu::info($value, __METHOD__);
     $ret = [];
     $level = ['一', '二', '三', '四', '五', '六', '七', '八', '九'];
     $items = explode("\r\n", $value);
     for ($i = 0; $i < 9; $i++) {
         if (isset($items[$i]) && !empty($items[$i])) {
             $ret[] = $items[$i];
         } else {
             $ret[] = $level[$i] . '级属性';
         }
     }
     return implode("\r\n", $ret);
 }
 public function getTpl($chnId, $tplType)
 {
     $ret = TFileHelper::buildPath(['model_default', str_replace('_tpl', '_default', $tplType)]);
     $cachedChannels = LuLu::getAppParam('cachedChannels');
     if (isset($cachedChannels[$chnId])) {
         $channelModel = $cachedChannels[$chnId];
         $table = $channelModel['table'];
         $tplName = $channelModel[$tplType];
         $tplPath = CommonUtility::getThemePath(['content', $table, $tplName]);
         if (TFileHelper::exist($tplPath)) {
             $ret = TFileHelper::buildPath([$table, $tplName]);
         } else {
             LuLu::info($tplPath . ' does not exist', __METHOD__);
         }
     }
     return $ret;
 }
 public function getTpl($chnId, $tplName)
 {
     $ret = TFileHelper::buildPath(['model_default', $tplName], false);
     $cachedChannels = LuLu::getAppParam('cachedChannels');
     if (isset($cachedChannels[$chnId])) {
         $backend = \Yii::getAlias('@backend');
         $channelModel = $cachedChannels[$chnId];
         $table = $channelModel['table'];
         $tplPath = TFileHelper::buildPath([$backend, 'views', 'content', $table, $tplName . '.php'], false);
         if (TFileHelper::exist($tplPath)) {
             $ret = TFileHelper::buildPath([$table, $tplName], false);
         } else {
             LuLu::info($tplPath . ' does not exist in backend', __METHOD__);
         }
     }
     return $ret;
 }
 public function afterValidate()
 {
     $errors = $this->getErrors();
     if (!empty($errors)) {
         LuLu::info($this, 'validate error:');
     }
 }