Example #1
0
 /**
  * Allow to processing of category data before it is saved.
  *
  * @param $data
  * @param $table
  * @param $isNew
  *
  * @return  void
  */
 function onCategoryBeforeSave($data, $table, $isNew)
 {
     $dbo = JFactory::getDbo();
     $srNode = SRFactory::getNode();
     $dbo->setQuery('LOCK TABLES ' . $dbo->quoteName('#__sr_categories') . ' WRITE, ' . $dbo->quoteName('#__assets') . ' WRITE');
     if (!$dbo->execute()) {
         $e = new JException(JText::sprintf('plgExtensionSolidres::onCategoryAfterSave Lock table failed', get_class($this), $dbo->getErrorMsg()));
         $this->setError($e);
         return false;
     }
     if ($isNew) {
         $srNode->saveNode($data['parent_id']);
     } else {
         $srNode->updateNode($data);
     }
 }