Example #1
0
 public function deleteSelection($selection)
 {
     if (!is_array($selection) or !Validate::isTableOrIdentifier($this->identifier) or !Validate::isTableOrIdentifier($this->table)) {
         die(Tools::displayError());
     }
     foreach ($selection as $id) {
         $obj = new Currency((int) $id);
         $res[$id] = $obj->delete();
     }
     foreach ($res as $value) {
         if (!$value) {
             return false;
         }
     }
     return true;
 }
 /**
  * Delete existing currency
  *
  * @param void
  * @return null
  */
 function delete()
 {
     if ($this->active_currency->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if ($this->request->isSubmitted()) {
         $delete = $this->active_currency->delete();
         if ($delete && !is_error($delete)) {
             flash_success('Currency ":name" has been deleted', array('name' => $this->active_currency->getName()));
         } else {
             flash_error('Failed to delete ":name" currency', array('name' => $this->active_currency->getName()));
         }
         // if
         $this->redirectTo('admin_currencies');
     } else {
         $this->httpError(HTTP_ERR_BAD_REQUEST);
     }
     // if
 }
 /**
  * Stores the Currencies as present in the POST request
  *
  * See {@see Currency::delete()},
  * {@see Currency::add()}, and
  * {@see Currency::update()}.
  */
 static function storeCurrencies()
 {
     //DBG::log("start of storeCurrencies: ".self::$success.", changed: ".self::$changed);
     $result = Currency::delete();
     if (isset($result)) {
         self::$changed = true;
         self::$success &= $result;
     }
     //DBG::log("after delete: ".self::$success.", changed: ".self::$changed);
     $result = Currency::add();
     if (isset($result)) {
         self::$changed = true;
         self::$success &= $result;
     }
     //DBG::log("after add: ".self::$success.", changed: ".self::$changed);
     $result = Currency::update();
     if (isset($result)) {
         self::$changed = true;
         self::$success &= $result;
     }
     //DBG::log("after update: ".self::$success.", changed: ".self::$changed);
     if (self::$changed) {
         // Remember to reinit the Currencies, or the User
         // won't see changes instantly
         Currency::reset();
     }
 }
Example #4
0
 public function deleteSelection($selection)
 {
     if (!is_array($selection)) {
         die(Tools::displayError());
     }
     foreach ($selection as $id) {
         $obj = new Currency((int) $id);
         $res[$id] = $obj->delete();
     }
     foreach ($res as $value) {
         if (!$value) {
             return false;
         }
     }
     return true;
 }
 public function deleteSelection($selection)
 {
     if (!is_array($selection)) {
         return false;
     }
     $res = array();
     foreach ($selection as $id) {
         $obj = new Currency((int) $id);
         $res[$id] = $obj->delete();
     }
     foreach ($res as $value) {
         if (!$value) {
             return false;
         }
     }
     return true;
 }