/** * Update the folder model data. * * @param integer $folderId The folder id. * @return boolean */ public function actionFolderUpdate($folderId) { $model = StorageFolder::findOne($folderId); if (!$model) { return false; } $model->attributes = Yii::$app->request->post(); $this->flushApiCache(); return $model->update(); }
/** * Add new folder to the storage system. * * @param string $folderName The name of the new folder * @param integer $parentFolderId If its a subfolder the id of the parent folder must be provided. * @return boolean|integer Returns the folder id or false if something went wrong. */ public function addFolder($folderName, $parentFolderId = 0) { $model = new StorageFolder(); $model->name = $folderName; $model->parent_id = $parentFolderId; $model->timestamp_create = time(); $this->deleteHasCache($this->_folderCacheKey); if ($model->save(false)) { return $model->id; } return false; }