getIds() public method

public getIds ( )
コード例 #1
0
 /**
  *
  * @service export_file delete
  * @param Gpf_Rpc_Params $params
  * @return Gpf_Rpc_Action
  */
 public function deleteFiles(Gpf_Rpc_Params $params)
 {
     $action = new Gpf_Rpc_Action($params);
     $action->setInfoMessage($this->_("File(s) %s was successfully deleted"));
     $action->setErrorMessage($this->_("Could not delete %s file(s)"));
     foreach ($action->getIds() as $id) {
         try {
             $export = new Gpf_Db_Export();
             $export->setPrimaryKeyValue($id);
             $export->load();
             $fileName = $export->getFileName();
             $export->delete();
         } catch (Exception $e) {
             $action->addError();
             continue;
         }
         $filePath = Gpf_Paths::getInstance()->getAccountDirectoryPath() . Gpf_Csv_ImportExportService::EXPORT_DIRECTORY . $fileName;
         $file = new Gpf_Io_File($filePath);
         if ($file->isExists()) {
             if ($file->delete()) {
                 $action->addOk();
             } else {
                 $action->addError();
             }
         } else {
             $action->addOk();
         }
     }
     return $action;
 }
コード例 #2
0
 /**
  *
  * @service filter delete
  * @param $filterid
  * @return Gpf_Rpc_Action
  */
 public function deleteFilters(Gpf_Rpc_Params $params)
 {
     $action = new Gpf_Rpc_Action($params);
     $action->setErrorMessage($this->_('Failed to delete %s filter(s)'));
     $action->setInfoMessage($this->_('%s filter(s) successfully deleted'));
     foreach ($action->getIds() as $filterid) {
         try {
             $this->delete($filterid);
         } catch (Exception $e) {
             $action->addError();
         }
     }
     return $action;
 }
コード例 #3
0
    /**
     *
     * @service recurring_transaction write
     * @param ids, status
     * @return Gpf_Rpc_Action
     */
    public function changeStatus(Gpf_Rpc_Params $params) {
        $action = new Gpf_Rpc_Action($params);
        $action->setInfoMessage($this->_("Status of selected recurring transaction(s) was changed"));
        $action->setErrorMessage($this->_("Failed to change status of selected recurring transaction(s)"));

        $ids = array();
        foreach ($action->getIds() as $id) {
            $ids[] = $id;
        }
        
        $status = $params->get("status");

        $this->massUpdateStatus($status, $ids, $action);

        return $action;
    }
コード例 #4
0
 /**
  * @service wallpaper delete
  * @param Gpf_Rpc_Params $params
  * @return Gpf_Rpc_Action
  */
 public function delete(Gpf_Rpc_Params $params)
 {
     $action = new Gpf_Rpc_Action($params);
     $action->setErrorMessage($this->_('Failed to delete %s wallpaper(s)'));
     $action->setInfoMessage($this->_('%s wallpaper(s) successfully deleted'));
     foreach ($action->getIds() as $id) {
         try {
             $row = new Gpf_Db_Wallpaper();
             $row->setPrimaryKeyValue($id);
             $row->delete();
             $action->addOk();
         } catch (Exception $e) {
             $action->addError();
         }
     }
     return $action;
 }
コード例 #5
0
 /**
  *
  * @service mail_outbox write
  * @param $ids
  * @return Gpf_Rpc_Action
  */
 public function restartSendingMail(Gpf_Rpc_Params $params)
 {
     $action = new Gpf_Rpc_Action($params);
     $action->setErrorMessage($this->_('Failed to restart %s row(s)'));
     $action->setInfoMessage($this->_('%s row(s) successfully restarted'));
     foreach ($action->getIds() as $id) {
         try {
             $update = new Gpf_SqlBuilder_UpdateBuilder();
             $update->from->add(Gpf_Db_Table_MailOutbox::getName());
             $update->set->add(Gpf_Db_Table_MailOutbox::ERROR_MSG, self::RESTART_ERROR_MSG);
             $update->set->add(Gpf_Db_Table_MailOutbox::RETRY_NR, self::RESTART_RETRY_NR);
             $update->set->add(Gpf_Db_Table_MailOutbox::SCHNEDULET_AT, Gpf_Common_DateUtils::now());
             $update->where->add(Gpf_Db_Table_MailOutbox::ID, '=', $id, 'AND');
             $update->where->add(Gpf_Db_Table_MailOutbox::STATUS, '=', self::STATUS_PENDING);
             $update->executeOne();
             $action->addOk();
         } catch (Exception $e) {
             $action->addError();
         }
     }
     return $action;
 }
コード例 #6
0
    /**
     * @service coupon write
     * @param ids, status
     * @return Gpf_Rpc_Action
     */
    public function changeStatus(Gpf_Rpc_Params $params) {
        $action = new Gpf_Rpc_Action($params);
        $action->setInfoMessage($this->_("Status successfully set to selected coupon(s)"));
        $action->setErrorMessage($this->_("Failed to set status selected coupon(s)"));

        $update = new Gpf_SqlBuilder_UpdateBuilder();
        $update->from->add(Pap_Db_Table_Coupons::getName());
        $update->set->add(Pap_Db_Table_Coupons::STATUS, $action->getParam("status"));

        foreach ($action->getIds() as $id){
            $update->where->add(Pap_Db_Table_Coupons::ID, "=", $id, "OR");
        }

        try {
            $update->execute();
            $action->addOk();
        } catch(Gpf_DbEngine_NoRowException $e) {
            $action->addError();
        }

        return $action;
    }
コード例 #7
0
    /**
     *
     * @service affiliate write
     * @param ids, status
     * @return Gpf_Rpc_Action
     */
    public function changeStatus(Gpf_Rpc_Params $params) {
        $action = new Gpf_Rpc_Action($params);
        $action->setInfoMessage($this->_("Selected affiliate(s) status is changed"));
        $action->setErrorMessage($this->_("Failed to change status for selected affiliate(s)"));

        foreach ($action->getIds() as $id){
            try {
                $trackingCode = $this->createDbRowObject();
                $trackingCode->setId($id);
                $trackingCode->load();
                if ($trackingCode->getStatus() == $action->getParam("status")) {
                    continue;
                }
                $trackingCode->setStatus($action->getParam("status"));
                $trackingCode->update();
                $action->addOk();
            } catch(Gpf_DbEngine_NoRowException $e) {
                $action->addError();
            }
        }

        return $action;
    }
コード例 #8
0
 /**
  * @service
  * @param $ids
  * @return Gpf_Rpc_Action
  */
 public function deleteRows(Gpf_Rpc_Params $params) {
     $action = new Gpf_Rpc_Action($params);
     $errorMessages = "";
     foreach ($action->getIds() as $id) {
         try {
             $row = $this->createDbRowObject();
             $row->setPrimaryKeyValue($id);
             $this->deleteRow($row);
             $action->addOk();
         } catch (Exception $e) {
             $action->addError();
             $errorMessages .= '<br/>' . $e->getMessage();
         }
     }
      
     $action->setErrorMessage($this->_('Failed to delete %s %s(s)', '%s', $this->getDbRowObjectName()) .
                                 '<br/>' .
     $this->_('Error details: %s', $errorMessages));
     $action->setInfoMessage($this->_('%s %s(s) successfully deleted', '%s', $this->getDbRowObjectName()));
      
     return $action;
 }
コード例 #9
0
    /**
     * @service user_comm_group add
     *
     * @param Gpf_Rpc_Params $params
     * @return Gpf_Rpc_Action
     */
    public function addUsers(Gpf_Rpc_Params $params) {
        $action = new Gpf_Rpc_Action($params);
        $action->setErrorMessage($this->_('Failed to invite %s %s', '%s', $this->getRowName()));
        $action->setInfoMessage($this->_('%s %s successfully invited', '%s', $this->getRowName()));

        $campaign = new Pap_Common_Campaign();
        $campaign->setId($action->getParam('campaignId'));
        try {
            $campaign->load();
            if ($campaign->getCampaignType() == Pap_Common_Campaign::CAMPAIGN_TYPE_PUBLIC) {
                $action->setErrorMessage($this->_('Campaign is not private or public with manual approval'));
                $action->addError();
                return $action;
            }
        } catch (Gpf_DbEngine_NoRowException $e) {
            $action->setErrorMessage($this->_('Campaign not exist'));
            $action->addError();
            return $action;
        }
        $commissionGroup = $campaign->getDefaultCommissionGroup();

        foreach ($action->getIds() as $id) {
            $this->addUserNoRpc($action, $action->getParam('campaignId'), $id, $commissionGroup, 'A', $action->getParam('sendNotification') == Gpf::YES);
        }
        return $action;
    }
コード例 #10
0
ファイル: Impression.php プロジェクト: AmineCherrai/rostanvo
 /**
  * changes status of user(s)
  *
  * @service affiliate write
  * @param ids - array of IDs
  * @param status - new status
  * @return Gpf_Rpc_Action
  */
 public function changeStatusUsers(Gpf_Rpc_Params $params)
 {
     $action = new Gpf_Rpc_Action($params);
     $action->setErrorMessage($this->_('Failed to change status for %s user(s)'));
     $action->setInfoMessage($this->_('Status successfully changed for %s user(s)'));
     $status = $action->getParam("status");
     if (!in_array($status, array(Gpf_Db_User::APPROVED, Gpf_Db_User::PENDING, Gpf_Db_User::DECLINED))) {
         throw new Exception($this->_("Status does not have allowed value"));
     }
     foreach ($action->getIds() as $userid) {
         try {
             $result = $this->changeStatus($userid, $status);
             $action->addOk();
         } catch (Exception $e) {
             $action->addError();
         }
     }
     return $action;
 }
コード例 #11
0
    /**
     *
     * @param $params
     * @return Gpf_Rpc_Action
     */
    private function saveChangedStatusToDB(Gpf_Rpc_Params $params) {
        $action = new Gpf_Rpc_Action($params);
        $action->setInfoMessage($this->_("Status successfully set to selected url(s)"));
        $action->setErrorMessage($this->_("Failed to set status selected url(s)"));

        $update = new Gpf_SqlBuilder_UpdateBuilder();
        $update->from->add(Pap_Db_Table_DirectLinkUrls::getName());
        $update->set->add(Pap_Db_Table_DirectLinkUrls::STATUS, $action->getParam("status"));

        foreach ($action->getIds() as $id){
            $update->where->add(Pap_Db_Table_DirectLinkUrls::ID, "=", $id, "OR");
        }

        try {
            $update->execute();
            $action->addOk();

            Pap_Tracking_DirectLinksBase::getInstance()->regenerateDirectLinksFile();
        } catch(Gpf_DbEngine_NoRowException $e) {
            $action->addError();
        }
        return $action;
    }
コード例 #12
0
    /**
     * @service campaign write
     * @return Gpf_Rpc_Action
     */
    public function setAsDefault(Gpf_Rpc_Params $params) {
        $action = new Gpf_Rpc_Action($params);
        $action->setErrorMessage($this->_('Failed to set default campaign'));
        $action->setInfoMessage($this->_('Default campaign changed'));

        foreach ($action->getIds() as $id) {
            try {
                $this->setCampaignDefault($id);
                $action->addOk();
                return $action;
            } catch (Exception $e) {
                $action->setErrorMessage($e->getMessage());
                $action->addError();
            }
        }
        return $action;
    }
コード例 #13
0
 /**
  * @service merchant write
  * @param Gpf_Rpc_Params $params
  * @return Gpf_Rpc_Action
  */    
 public function setAsDefault(Gpf_Rpc_Params $params) {
 	$action = new Gpf_Rpc_Action($params);
     $action->setErrorMessage($this->_('Failed to set default merchant'));
     $action->setInfoMessage($this->_('Default merchant changed'));      
     foreach ($action->getIds() as $id) {
         try {
             Gpf_Settings::set(Pap_Settings::DEFAULT_MERCHANT_ID, $id);
             $action->addOk();
             return $action;
         } catch (Exception $e) {
         }
     }
     $action->addError();
     return $action;
 }
コード例 #14
0
    /**
     *
     * @service user_in_commission_group write
     * @param ids, status
     * @return Gpf_Rpc_Action
     */
    public function changeStatus(Gpf_Rpc_Params $params) {
        $action = new Gpf_Rpc_Action($params);
        $action->setInfoMessage($this->_("Selected affiliate(s) status is changed"));
        $action->setErrorMessage($this->_("Failed to change status for selected affiliate(s)"));

        foreach ($action->getIds() as $id){
            try {
                $userInCommGroup = $this->createDbRowObject();
                $userInCommGroup->setPrimaryKeyValue($id);
                $userInCommGroup->load();
                if ($userInCommGroup->getStatus() == $action->getParam("status")) {
                    continue;
                }
                $userInCommGroup->setStatus($action->getParam("status"));
                $userInCommGroup->save();
                $this->sendMail($userInCommGroup);
                $action->addOk();
            } catch(Gpf_DbEngine_NoRowException $e) {
                $action->addError();
            }
        }
        return $action;
    } 
コード例 #15
0
    /**
     * @service affiliate write
     * @return Gpf_Rpc_Action
     */
    public function sendRequestPassword(Gpf_Rpc_Params $params) {
        $action = new Gpf_Rpc_Action($params, $this->_('New password request email successfully sent'), $this->_('Failed to send new password request email'));

        foreach ($action->getIds() as $id) {
            try {
                $affiliate = $this->loadUserFromId($id);
                if ($affiliate->getStatus() == Pap_Common_Constants::STATUS_APPROVED) {
                    $user = $affiliate->getAuthUser();
                    $mail = new Gpf_Auth_RequestNewPasswordMail();
                    $mail->setUser($user);
                    $mail->setUrl(Gpf_Paths::getInstance()->getFullBaseServerUrl() . "affiliates/login.php");
                    $this->sendMail($user, $mail);
                    $action->addOk();
                } else {
                    $action->addError();
                }
            } catch (Exception $e) {
                $action->addError();
            }
        }

        return $action;
    }
コード例 #16
0
 protected function getUserIdsFromFilter(Gpf_Rpc_Action $action) {
     $userIds = array();
     foreach ($action->getIds() as $id) {
         $userIds[] = $id;
     }
     return $userIds;
 }
コード例 #17
0
 /**
  *  @service banner_format_setting write
  */
 public function addWrapper(Gpf_Rpc_Params $params) {
     $action = new Gpf_Rpc_Action($params);
     try {
         foreach ($action->getIds() as $name) {
             $row = new Pap_Db_BannerWrapper();
             $row->setName($name);
             $row->insert();
         }
     } catch (Exception $e) {
         $action->setErrorMessage($e->getMessage());
         $action->addError();
     }
     return $action;
 }
コード例 #18
0
    /**
     * @service affiliate_panel_settings delete
     * @return Gpf_Rpc_Action
     */
    public function deleteRows(Gpf_Rpc_Params $params) {
        $action = new Gpf_Rpc_Action($params);

        $action->setInfoMessage($this->_('Affiliate screen successfully deleted'));

        foreach ($action->getIds() as $id) {
            try {
                $row = $this->createDbRowObject();
                $row->setPrimaryKeyValue($id);
                $row->delete();
                $action->addOk();
            } catch (Exception $e) {
                $action->setErrorMessage($e->getMessage());
                $action->addError();
            }
        }

        return $action;
    }
コード例 #19
0
    /**
     *
     * @service
     * @anonym
     * @param ids, status
     * @return Gpf_Rpc_Action
     */
    public function makeRefundChargeback(Gpf_Rpc_Params $params) {
        if (!Gpf_Session::getAuthUser()->hasPrivilege(Pap_Privileges::TRANSACTION, Pap_Privileges::P_WRITE) && 
        !Gpf_Session::getAuthUser()->hasPrivilege(Pap_Privileges::TRANSACTION, Pap_Privileges::P_REFUND)) {
            throw new Gpf_Rpc_PermissionDeniedException('Pap_Merchants_Transaction_TransactionsForm', 'makeRefundChargeback');
        }
        $action = new Gpf_Rpc_Action($params, $this->_("Refund / chargeback of selected transaction(s) was successfully made"),
        $this->_("Failed to make refund / chargeback of selected transaction(s)"));

        $note = $action->getParam(self::REFUND_MERCHANT_NOTE);
        foreach ($action->getIds() as $id) {
            try {
                $transaction = new Pap_Common_Transaction();
                $transaction->processRefundChargeback($id, $action->getParam(self::REFUND_TYPE), $note, '',
                $action->getParam(self::REFUND_FEE), $this->isMultitierRefund($action));
                $action->addOk();
            } catch (Exception $e) {
                $action->addError();
            }
        }

        return $action;
    }
コード例 #20
0
 /**
  * @service gadget delete
  * @param Gpf_Rpc_Params $params
  * @return Gpf_Rpc_Action
  */
 public function closeGadget(Gpf_Rpc_Params $params)
 {
     $action = new Gpf_Rpc_Action($params);
     $action->setErrorMessage($this->_('Failed to close gadget'));
     $action->setInfoMessage($this->_('Gadget successfully closed'));
     foreach ($action->getIds() as $id) {
         try {
             $gadget = $this->createDbRowObject();
             $gadget->setPrimaryKeyValue($id);
             $gadget->delete();
             $action->addOk();
         } catch (Exception $e) {
             $action->addError();
         }
     }
     return $action;
 }
コード例 #21
0
 /**
  * @service banner add
  * @param $fields
  */
 public function cloneBanners(Gpf_Rpc_Params $params) {
     $action = new Gpf_Rpc_Action($params);
     $campaign = $action->getParam('campaign');
     $url = $action->getParam('url');
     try {
         foreach ($action->getIds() as $id) {
             $row = new Pap_Db_Banner();
             $row->setId($id);
             $row->load();
             $this->cloneBanner($row,$campaign,$url);
         }
     } catch (Exception $e) {
         $action->setErrorMessage($e->getMessage());
         $action->addError();
     }
     return $action;
 }