Exemplo n.º 1
0
 protected function generateItems()
 {
     $moduleName = Module::moduleName($this);
     $model = Module::getModel($this, 'Category', ['widgets' => 'models']);
     $items = $model::find()->orderBy(['lft' => SORT_ASC])->asArray()->all();
     foreach ($items as &$item) {
         $uniqueKey = self::$uniqueKey++;
         $nodeId = $uniqueKey . '-id-' . $item['id'];
         $item['nodeAttributes'] = ['id' => $nodeId, 'text' => $item['name'], 'type' => 'folder', 'active' => \Yii::$app->request->get('id') == $item['id'], 'a_attr' => ['data-id' => $nodeId, 'href' => ["/{$moduleName}/category/update", 'id' => $item['id']]]];
     }
     return $items;
 }
Exemplo n.º 2
0
 /**
  * Relative path for saving model files.
  * @return string path.
  */
 public function getStoragePath()
 {
     $moduleName = \bariew\postModule\Module::moduleName($this);
     $user_id = $this->getAttribute('user_id') ?: Yii::$app->user->id;
     return "@app/web/files/{$user_id}/{$moduleName}/" . $this->formName() . '/' . $this->id;
 }
Exemplo n.º 3
0
 /**
  * Relative path for saving model files.
  * @return string path.
  */
 public function getStoragePath()
 {
     $moduleName = \bariew\postModule\Module::moduleName($this);
     return "@app/web/files/{$moduleName}/" . $this->formName() . '/' . $this->id;
 }