Exemplo n.º 1
0
 /**
  * A protected method to get a set of ordering conditions.
  *
  * @param    GamificationTableBadge $table
  *
  * @return    array    An array of conditions to add to add to ordering queries.
  * @since    1.6
  */
 protected function getReorderConditions($table)
 {
     $condition = array();
     $condition[] = 'group_id = ' . (int) $table->get('group_id');
     return $condition;
 }
Exemplo n.º 2
0
 /**
  * Prepare and sanitise the table prior to saving.
  *
  * @param GamificationTableBadge $table
  * @param array                  $data
  *
  * @since    1.6
  */
 protected function prepareImage($table, $data)
 {
     if (!empty($data["image"])) {
         // Delete old image if I upload the new one
         if (!empty($table->image)) {
             $params = JComponentHelper::getParams($this->option);
             /** @var  $params Joomla\Registry\Registry */
             $file = JPath::clean(JPATH_ROOT . DIRECTORY_SEPARATOR . $params->get("images_directory", "images/gamification") . DIRECTORY_SEPARATOR . $table->image);
             if (is_file($file)) {
                 JFile::delete($file);
             }
         }
         $table->set("image", $data["image"]);
     }
 }