Exemple #1
0
 public function afterDelete()
 {
     parent::afterDelete();
     // Find all instances of the gateway in profiles_gateways...
     $sql = "SELECT * \n\t\tFROM profiles_gateways\n\t\tWHERE gateway_id = ?i";
     $result = self::$_msql->getAll($sql, $this->getPkValue());
     // Delete instances and reorder the rank of profile gateways
     foreach ($result as $key => $value) {
         $model = new ProfileGateway();
         $model->profile_id = $value['profile_id'];
         $model->method_id = $value['method_id'];
         $model->gateway_id = $value['gateway_id'];
         $rank = $model->getRank();
         $model->delete();
         $model->decreaseRanksByOne($rank);
         unset($model);
     }
 }
Exemple #2
0
 function change_rankAction()
 {
     $profile_id = AF::get($_POST, 'profile_id', 0);
     $change = AF::get($_POST, 'change', 0);
     if ($change == "up") {
         $change = -1;
     } else {
         $change = +1;
     }
     $model = new ProfileGateway();
     $model->fillFromArray($_POST);
     $model->changeRank($change);
     unset($model);
     Message::echoJsonRedirect("/lj3/profiles/update/id=" . $profile_id);
 }