setInfoMessage() 공개 메소드

public setInfoMessage ( $message )
예제 #1
0
    /**
     * @service theme write
     */
    public function revertFile(Gpf_Rpc_Params $params) {
        $action = new Gpf_Rpc_Action($params);
        try{
            $themeId = $action->getParam('themeId');
            $itemId = $action->getParam("Id");
            $themeBase = $this->getThemeFile($action->getParam('panelName'));

            $file_original = new Gpf_Io_File($themeBase.'/'.Gpf_Paths::DEFAULT_THEME.$itemId);
            $file_new = new Gpf_Io_File($themeBase.'/'.$themeId.$itemId);

            if($file_original->isExists() && $file_new->isExists()){
                if(!$file_new->delete()){
                    throw new Gpf_Exception(_("Revert of file has failed"));
                }else{
                    $action->setInfoMessage(_("Revert of file success"));
                }
            }else{
                $action->setInfoMessage(_("This file cannot be reverted"));
            }
            $action->addOk();
        }catch (Gpf_Exception $e){
            $action->addError();
            $action->setErrorMessage($e->getMessage());
        }
        return $action;
    }
예제 #2
0
 /**
  *
  * @param $params
  * @param $activate
  * @return Gpf_Rpc_Action
  */
 private function pluginChangeState(Gpf_Rpc_Params $params, $activate)
 {
     $action = new Gpf_Rpc_Action($params);
     $code = $action->getParam("code");
     if (defined('ENABLE_ENGINECONFIG_LOG')) {
         Gpf_Log::info('pluginChangeState: ' . $code . ', activate:' . $activate);
     }
     $engineConfig = Gpf_Plugins_Engine::getInstance();
     try {
         $engineConfig->activate($code, $activate);
         $engineConfig->saveConfiguration();
         if ($activate) {
             $action->setInfoMessage($this->_('Plugin was successfully activated'));
         } else {
             $action->setInfoMessage($this->_('Plugin was successfully deactivated'));
         }
         $action->addOk();
     } catch (Exception $e) {
         if (defined('ENABLE_ENGINECONFIG_LOG')) {
             Gpf_Log::error('pluginChangeState-error: ' . $e->getMessage());
         }
         $action->setErrorMessage($e->getMessage());
         $action->addError();
     }
     return $action;
 }
예제 #3
0
 /**
  * Execute cron manually from UI (request can take max 10 seconds)
  *
  * @service tasks execute
  * @return Gpf_Rpc_Action
  */
 public function manualExecution(Gpf_Rpc_Params $params)
 {
     $action = new Gpf_Rpc_Action($params);
     if (Gpf_Application::getInstance()->isInMaintenanceMode()) {
         $action->setInfoMessage($this->_('Upgrade in progress'));
     } else {
         $this->runExistingTasks(10, null, array());
         $this->scheduleNewTasks(null, array());
         $action->setInfoMessage($this->_('Cron request finished.'));
     }
     $action->addOk();
     return $action;
 }
예제 #4
0
 /**
  * @service banner read
  * @param $bannerId
  * @return Gpf_Rpc_Action
  */
 public function check(Gpf_Rpc_Params $params) {
     $response = new Gpf_Rpc_Action($params);
     $bannerFactory = new Pap_Common_Banner_Factory();
     $site = $bannerFactory->getBanner($params->get('id'));
     $site->setDestinationUrl(rtrim($params->get('url'), "/\\").'/');
     
     $response->setInfoMessage('Site replication .htaccess is working at this location');
     $response->setErrorMessage('Site replication .htaccess is not set up at this location or it is not working correctly. Please make sure that you have mod_rewrite and mod_proxy enabled in your Apache configuration');
     
     $testUser = new Pap_Common_User();
     $testUser->setRefId(Pap_Features_SiteReplication_Replicator::TEST_STRING);
     $request = new Gpf_Net_Http_Request();
     $request->setUrl($site->getUrl($testUser).Pap_Features_SiteReplication_Replicator::TEST_STRING);
     $httpClient = new Gpf_Net_Http_Client();
     try {
         $testResponse = $httpClient->execute($request);
         if ($testResponse->getBody() == Pap_Features_SiteReplication_Replicator::TEST_RESPONSE) {
             $response->addOk();
         } else {
             $response->addError();                
         }
     } catch (Gpf_Exception $e) {
         $response->addError();
     }
     
     return $response;
 }
 /**
  *
  * @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;
 }
    protected function saveFieldsRpc(Gpf_Rpc_Params $params) {
        $action = new Gpf_Rpc_Action($params);
        $action->setErrorMessage($this->_('Failed to save %s field(s) in %s(s)', '%s', $this->getDbRowObjectName()));
        $action->setInfoMessage($this->_('%s field(s) in %s(s) successfully saved', '%s', $this->getDbRowObjectName()));

        $fields = new Gpf_Data_RecordSet();
        $fields->loadFromArray($action->getParam("fields"));


        foreach ($fields as $field) {
            $dbRow = $this->createDbRowObject();
            $dbRow->setPrimaryKeyValue($field->get(Gpf_Db_Table_FormFields::ID));
            $dbRow->load();
            $dbRow->setName($field->get(Gpf_Db_Table_FormFields::NAME));
            $dbRow->setStatus($field->get(Gpf_Db_Table_FormFields::STATUS));
            $dbRow->setType($field->get(Gpf_Db_Table_FormFields::TYPE));
            if ($field->get(Gpf_Db_Table_FormFields::AVAILABLEVALUES) != null) {
                $dbRow->setAvailableValues($field->get(Gpf_Db_Table_FormFields::AVAILABLEVALUES));
            }
            $dbRow->save();
            $action->addOk();
        }

        return $action;
    }
예제 #7
0
    /**
     * @service channel write
     *
     * @param $fields
     * @return Gpf_Rpc_Action
     */
    public function saveFields(Gpf_Rpc_Params $params) {
        $action = new Gpf_Rpc_Action($params);
        $action->setErrorMessage($this->_('Failed to save %s field(s)'));
        $action->setInfoMessage($this->_('%s field(s) successfully saved'));
        
        $fields = new Gpf_Data_RecordSet();
        $fields->loadFromArray($action->getParam("fields"));
        
        $channels = Pap_Db_Table_Channels::getUserChannels(Gpf_Session::getAuthUser()->getPapUserId());
        
        foreach ($fields as $field) {
        	$isUnique = true;
        	foreach ($channels as $channel) {
        		if ($field->get('value') == $channel->get(Pap_Db_Table_Channels::VALUE)) {
        			$isUnique = false;
        			break;
        		}
        	}
        	if ($isUnique) {
        		$this->saveField($field);
        	} else {
        		$action->setErrorMessage($this->_("Failed to save %s field(s). Data with value '".$field->get('value').
        		  "' already exist. Data must be unique."));
        		$action->addError();
        		return $action;
        	}
        }

        $action->addOk();

        return $action;
    }
예제 #8
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;
 }
예제 #9
0
 /**
  * @service wallpaper add
  * @param Gpf_Rpc_Params $params
  * @return Gpf_Rpc_Action
  */
 public function addUrlWallpaper(Gpf_Rpc_Params $params)
 {
     $action = new Gpf_Rpc_Action($params);
     $action->setInfoMessage("Wallpaper added");
     $url = $action->getParam('url');
     $name = basename($url);
     $wallpaper = new Gpf_Db_Wallpaper();
     $wallpaper->setAccountUserId(Gpf_Session::getAuthUser()->getAccountUserId());
     $wallpaper->setName($name);
     $wallpaper->setUrl($url);
     $wallpaper->insert();
     $action->addOk();
     return $action;
 }
예제 #10
0
 /**
  *
  * @service campaigns_categories write
  * @param $fields
  * @return Gpf_Rpc_Action
  */
 public function saveTree(Gpf_Rpc_Params $params) {
     $action = new Gpf_Rpc_Action($params);
     $action->setInfoMessage($this->_("Campaign categories structure was saved"));
     
     try {
         $tree = new Pap_Features_CampaignsCategories_Tree(false);
         $tree->save($action->getParam(self::CAMPAIGNS_CATEGORIES_TREE));
         $action->addOk();
     } catch (Gpf_Exception $e) {
         $action->setErrorMessage($e);
         $action->addError();
         return $action;
     }
     return $action;
 }
예제 #11
0
 /**
  *
  * @service log delete
  * @param none
  * @return Gpf_Rpc_Action
  */
 public function deleteDebugEvents(Gpf_Rpc_Params $params)
 {
     $action = new Gpf_Rpc_Action($params);
     $action->setInfoMessage($this->_("Debug event(s) are deleted"));
     $action->setErrorMessage($this->_("No debug event(s) to delete"));
     $delete = new Gpf_SqlBuilder_DeleteBuilder();
     $delete->from->add(Gpf_Db_Table_Logs::getName());
     $delete->where->add(Gpf_Db_Table_Logs::LEVEL, "=", self::LOG_DEBUG);
     try {
         $delete->execute();
         $action->addOk();
     } catch (Gpf_DbEngine_NoRowException $e) {
         $action->addError();
     }
     return $action;
 }
예제 #12
0
    /**
     * @service theme write
     *
     * @return Gpf_Rpc_Action
     */
    public function setTheme(Gpf_Rpc_Params $params) {
        $action = new Gpf_Rpc_Action($params);
        $action->setErrorMessage($this->_("Error changing theme"));
        $action->setInfoMessage($this->_("Theme changed"));

        try {
            $themeId = $action->getParam('themeId');
            Gpf_Session::getAuthUser()->setTheme($themeId);
            Gpf_Settings::set($action->getParam('settingName'), $themeId);
            $action->addOk();
        } catch (Exception $e) {
            $action->addError();
        }

        return $action;
    }
    /**
     * @service commission_group write
     *
     * @param $fields
     * @return Gpf_Rpc_Action
     */
    public function saveFields(Gpf_Rpc_Params $params) {
        $action = new Gpf_Rpc_Action($params);
        $action->setErrorMessage($this->_('Failed to save %s field(s) in %s(s)', '%s', $this->_('commission group')));
        $action->setInfoMessage($this->_('%s field(s) in %s(s) successfully saved', '%s', $this->_('commission group')));

        $userId = $action->getParam('id');
        $fields = new Gpf_Data_RecordSet();
        $fields->loadFromArray($action->getParam("fields"));

        foreach ($fields as $field) {
        	$this->saveCommissionGroup($field->get('id'), $userId, $field->get("value"));
            $action->addOk();
        }

        return $action;
    }
예제 #14
0
    /**
     * @service coupon write
     * @param Id
     * @return Gpf_Rpc_Action
     */
    public function assignCoupon(Gpf_Rpc_Params $params) {
        $action = new Gpf_Rpc_Action($params);
        $action->setErrorMessage($this->_('Failed to assign coupon'));
        $action->setInfoMessage($this->_('Coupon was successfully assigned'));

        $coupon = new Pap_Features_Coupon_Coupon();
        $coupon->setId($action->getParam('id'));
        try {
            $unusedCoupon = $coupon->getUnusedCoupon();
            $unusedCoupon->setUserID(Gpf_Session::getAuthUser()->getPapUserId());
            $unusedCoupon->save();
            $action->addOk();
        } catch (Gpf_Exception $e) {
            $action->addError();
        }

        return $action;
    }
	/**
	 * @service affiliate_tracking_code write_own
	 * @param $ids
	 * @return Gpf_Rpc_Action
	 */
	public function saveFields(Gpf_Rpc_Params $params) {
		$action = new Gpf_Rpc_Action($params);
		$action->setErrorMessage($this->_('Failed to save %s field(s) in %s(s)', '%s', $this->getDbRowObjectName()));
		$action->setInfoMessage($this->_('%s field(s) in %s(s) successfully saved', '%s', $this->getDbRowObjectName()));

		$fields = new Gpf_Data_RecordSet();
		$fields->loadFromArray($action->getParam("fields"));

		foreach ($fields as $field) {
			$dbRow = $this->loadAffTrackingCode($field);
			$dbRow->setStatus(Pap_Common_Constants::STATUS_PENDING);
			$dbRow->set($field->get("name"), $field->get("value"));
			$dbRow->save();
			$action->addOk();
		}

		return $action;
	}
예제 #16
0
 /**
  * @service gadget write
  * @return Gpf_Rpc_Action
  */
 public function saveGadgets(Gpf_Rpc_Params $params)
 {
     $action = new Gpf_Rpc_Action($params);
     $action->setInfoMessage($this->_('Gadgets saved'));
     $gadgets = new Gpf_Data_RecordSet();
     $gadgets->loadFromArray($action->getParam('gadgets'));
     foreach ($gadgets as $gadgetRecord) {
         $gadget = new Gpf_Db_Gadget();
         $gadget->setPrimaryKeyValue($gadgetRecord->get("gadgetid"));
         try {
             $gadget->load();
         } catch (Gpf_Db_NoRowException $e) {
         }
         $gadget->fillFromRecord($gadgetRecord);
         $gadget->set('accountuserid', Gpf_Session::getAuthUser()->getAccountUserId());
         $gadget->save();
     }
     $action->addOk();
     return $action;
 }
    /**
     *
     * @service click delete
     * @param ids, status
     * @return Gpf_Rpc_Action
     */
    public function deleteClicks(Gpf_Rpc_Params $params) {
        $action = new Gpf_Rpc_Action($params);
        
        $date = array();
    	switch ($action->getParam("status")) {
    		case self::DATE_ONE_WEEK:
    			$filter = new Gpf_SqlBuilder_Filter(array("", "DP", "L7D"));
    	        $date = $filter->addDateValueToArray($date);
    	        $olderThan = "one week";
    			break;
    		case self::DATE_TWO_WEEKS:
    			$dateFrom = Gpf_DbEngine_Database::getDateString(
    			     Gpf_Common_DateUtils::getServerTime(
    			         mktime(0,0,0,date("m"), date("d") - 14, date("Y"))));
                $date = array("dateFrom" => $dateFrom);
                $olderThan = "two weeks";
    			break;
    		case self::DATE_ONE_MONTH:
    			$filter = new Gpf_SqlBuilder_Filter(array("", "DP", "L30D"));
                $date = $filter->addDateValueToArray($date);
                $olderThan = "one month";
    			break;
    	}
    	
    	$action->setInfoMessage($this->_("Raw clicks older than %s are deleted", $olderThan));
        $action->setErrorMessage($this->_("Failed to delete raw clicks"));
        
        $delete = new Gpf_SqlBuilder_DeleteBuilder();
        $delete->from->add(Pap_Db_Table_RawClicks::getName());
        $delete->where->add(Pap_Db_Table_RawClicks::DATETIME, "<", $date["dateFrom"]);
        

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

        return $action;
    }
예제 #18
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;
 }
예제 #19
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;
    }
    /**
     *
     * @service direct_link read_own
     * @param Gpf_Rpc_Params $params (pattern, url)
     * @return Gpf_Rpc_Action
     */
    public function checkUrlMatch(Gpf_Rpc_Params $params) {
        $action = new Gpf_Rpc_Action($params);
        $action->setErrorMessage($this->_("Pattern didn't matched the URL, check your pattern"));
        $action->setInfoMessage($this->_("Pattern matched the URL"));

        $pattern = $action->getParam("pattern");
        $url = $action->getParam("url");

        $url = str_replace('https://', '', $url);
        $url = str_replace('http://', '', $url);

        $directLinksBase = Pap_Tracking_DirectLinksBase::getInstance();
        $pattern = $directLinksBase->transformToPreg($pattern);

        if ($directLinksBase->isMatch($url, '', $pattern)) {
            $action->addOk();
        } else {
            $action->addError();
        }

        return $action;
    }
예제 #21
0
 /**
  * @service country write
  *
  * @param $id
  * @return Gpf_Rpc_Action
  */
 public function setDefaultCountry(Gpf_Rpc_Params $params)
 {
     $action = new Gpf_Rpc_Action($params);
     $action->setErrorMessage($this->_("Error changing default country"));
     $action->setInfoMessage($this->_("Default country changed"));
     try {
         $countryCode = $action->getParam('id');
         Gpf_Settings::set(Gpf_Settings_Gpf::DEFAULT_COUNTRY, $countryCode);
         $country = new Gpf_Db_Country();
         $country->setCountryCode($countryCode);
         $country->setAccountId(Gpf_Session::getAuthUser()->getAccountId());
         $country->loadFromData(array(Gpf_Db_Table_Countries::COUNTRY_CODE, Gpf_Db_Table_Countries::ACCOUNTID));
         if ($country->getStatus() != Gpf_Db_Country::STATUS_ENABLED) {
             $country->setStatus(Gpf_Db_Country::STATUS_ENABLED);
             $country->save();
         }
         $action->addOk();
     } catch (Exception $e) {
         $action->addError();
     }
     return $action;
 }
예제 #22
0
    /**
     * @service views write
     *
     * @param $id
     * @return Gpf_Rpc_Action
     */
    public function setDefaultView(Gpf_Rpc_Params $params) {
        $action = new Gpf_Rpc_Action($params);
        $action->setErrorMessage($this->_("Error changing default view"));
        $action->setInfoMessage($this->_("Default view changed"));

        try {
            $viewType = $action->getParam('id');
            $activeView = new Gpf_Db_ActiveView();
            $activeView->setViewType($viewType);
            $activeView->setAccountUserId(Gpf_Session::getAuthUser()->getUserData()->get(Gpf_Db_Table_Users::ID));
            $activeView->loadFromData(array(Gpf_Db_Table_ActiveViews::VIEWTYPE, Gpf_Db_Table_ActiveViews::ACCOUNTUSERID));

            if ($activeView->getActiveViewId() != Gpf_View_ViewService::DEFAULT_VIEW_ID) {
                $activeView->setActiveViewId(Gpf_View_ViewService::DEFAULT_VIEW_ID);
                $activeView->save();
            }
            $action->addOk();
        } catch (Exception $e) {
            $action->addError();
        }

        return $action;
    }
    /**
     *
     * @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;
    }
예제 #24
0
 /**
  * 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;
 }
예제 #25
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;
 }
예제 #26
0
    /**
     * @service grid_view write
     *
     * @param $gridcode
     * @param $viewid
     * @return Gpf_Rpc_Action
     */
    public function saveActiveView(Gpf_Rpc_Params $params) {
        $action = new Gpf_Rpc_Action($params);
        $action->setInfoMessage($this->_("Active view changed"));
        $action->setErrorMessage($this->_("Error while changing active view"));

        $viewId = $action->getParam("viewid");
        if ($viewId != self::DEFAULT_VIEW_ID) {
            try {
                $view = new Gpf_Db_View();
                $view->set(Gpf_Db_Table_Views::ID, $viewId);
                $view->load();
            } catch (Gpf_DbEngine_NoRowException $e) {
                $action->setErrorMessage($this->_("View does not exist"));
                $action->addError();
                return $action;
            }
        }

        $activeViewsTable = Gpf_Db_Table_ActiveViews::getInstance();
        $activeViewsTable->saveActiveView($action->getParam('gridcode'), $viewId);

        $action->addOk();
        return $action;
    }
    /**
     * @service user_comm_group add
     *
     * @param Gpf_Rpc_Params $params
     * @return Gpf_Rpc_Action
     */
    public function addUser(Gpf_Rpc_Params $params) {
        $action = new Gpf_Rpc_Action($params);
        $action->setInfoMessage($this->_('%s successfully add', $this->getRowName()));
        $campaignId = $action->getParam('campaignId');

        $cTable = Pap_Db_Table_Commissions::getInstance();
        $commissionGroup = $cTable->getDefaultCommissionGroup($campaignId);

        $this->addUserNoRpc($action, $campaignId, Gpf_Session::getAuthUser()->getPapUserId(), $commissionGroup, 'P', $action->getParam('sendNotification') == Gpf::YES);

        return $action;
    }
예제 #28
0
	/**
	 *
	 * @service commission write
	 * @param $fields
	 * @return Gpf_Rpc_Action
	 */
	public function deleteCommissionType(Gpf_Rpc_Params $params) {
		$action = new Gpf_Rpc_Action($params);
		$action->setErrorMessage($this->_('Failed to delete type, some transactions are connected to this type. Remove them first.'));
		$action->setInfoMessage($this->_('Commission type successfully removed'));

		$commTypeId = $action->getParam('commtypeid');

		$transaction = new Pap_Db_Transaction();
		$transaction->setCommissionTypeId($commTypeId);
		$collection = $transaction->loadCollection(array(Pap_Db_Table_Transactions::COMMISSIONTYPEID));
		if ($collection->getSize() > 0) {
			$action->addError();
			return $action;
		}

        $commissionType = new Pap_Db_CommissionType();
        $commissionType->setId($commTypeId);
        $commissionType->delete();

        $action->addOk();
        return $action;
	}
예제 #29
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;
    }
예제 #30
0
 /**
  * Set language as default and unset another default language
  *
  * @service language write
  * @param Gpf_Rpc_Params $params
  * @return Gpf_Rpc_Action
  */
 public function setLanguageAsDefault(Gpf_Rpc_Params $params)
 {
     $action = new Gpf_Rpc_Action($params);
     try {
         Gpf_Db_Table_Languages::getInstance()->unsetDefaultLanguage($action->getParam(Gpf_Db_Table_Languages::ID));
         $lang = new Gpf_Db_Language();
         $lang->setId($action->getParam(Gpf_Db_Table_Languages::ID));
         $lang->load();
         $lang->setIsDefault(true);
         $lang->save();
     } catch (Exception $e) {
         $action->addError();
         $action->setErrorMessage($this->_('Failed to set default language with error: %s', $e->getMessage()));
         return $action;
     }
     $action->setInfoMessage($this->_('Language %s set as default.', $lang->getEnglishName()));
     $action->addOk();
     return $action;
 }