Example #1
0
 protected function beforeSave(&$Item, $id, &$item, &$request, $func)
 {
     parent::beforeSave($Item, $id, $item, $request, $func);
     //check if the relationship of id, UAL, and category is correct
     if ($this->CategoryWithUAM == true && Category::isCurrentUserPassCategoryItem($this->Name, $request->category, true) == false) {
         throw new Exception('category1');
     }
     //check category, ($id != 0 means Root, because Root has no category.)
     if ($this->CheckIfUserPassCategory == true && Category::isUserPassCategoryItem($this->Name, $request->category, $request->UAL, $request->id, false) == false) {
         throw new Exception('user_not_pass_category');
     }
 }