Inheritance: extends Gpf_Object, implements Gpf_Rpc_Serializable
コード例 #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
 /**
  * Delete pending background task if it is allowed
  *
  * @service tasks delete
  * @param $params
  * @return Gpf_Rpc_Action
  */
 public function deleteTask(Gpf_Rpc_Params $params)
 {
     $action = new Gpf_Rpc_Action($params);
     $dbTask = new Gpf_Db_Task();
     try {
         $dbTask->setId($action->getParam('taskid'));
         $dbTask->load();
     } catch (Gpf_Exception $e) {
         $action->addError();
         $action->setErrorMessage($this->_('Failed to delete task.'));
         return $action;
     }
     if ($dbTask->isExecuting()) {
         $action->addError();
         $action->setErrorMessage($this->_('It is not possible to delete running task.'));
         return $action;
     }
     try {
         $longTask = Gpf::newObj($dbTask->getClassName());
         if (!$longTask->canUserDeleteTask()) {
             $action->addError();
             $action->setErrorMessage($this->_('This type of task is not allowed to be deleted.'));
             return $action;
         }
     } catch (Gpf_Exception $e) {
     }
     $dbTask->delete();
     $action->addOk();
     $action->setInfoMessage($this->_('Task deleted.'));
     return $action;
 }
コード例 #3
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;
 }
コード例 #4
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;
    }
コード例 #5
0
 /**
  * Checks if signup form is ok
  *
  * @service affiliate_signup_setting read
  * @param Gpf_Rpc_Params $params
  * @return Gpf_Rpc_Action
  */
 public function checkSignupFieldsRpc(Gpf_Rpc_Params $params) {
     $action = new Gpf_Rpc_Action($params);
     try {
         $this->checkSignupFields();
         $action->addOk();
     } catch (Exception $e) {
         $action->setErrorMessage($e->getMessage());
         $action->addError();
     }
     return $action;
 }
コード例 #6
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;
 }
コード例 #7
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;
 }
コード例 #8
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;
 }
コード例 #9
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;
 }
コード例 #10
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;
 }
コード例 #11
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;
 }
コード例 #12
0
    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;
    }
コード例 #13
0
    /**
     *
     * @service user_comm_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 commission group(s) are changed"));
        $action->setErrorMessage($this->_("Failed to change status"));

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

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

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

        return $action;
    }
コード例 #14
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;
 }
コード例 #15
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;
    }
コード例 #16
0
    /**
     * @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;
    }
コード例 #17
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;
    }
コード例 #18
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;
 }
コード例 #19
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;
    }
コード例 #20
0
    /**
     *
     * @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 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;
 }
コード例 #22
0
    /**
     *
     * @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;
    }
コード例 #23
0
	/**
	 * @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;
	}
コード例 #24
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;
 }
コード例 #25
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;
 }
コード例 #26
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;
    }
コード例 #27
0
 /**
  *
  * @service uploaded_file delete
  * @param Gpf_Rpc_Params $params
  * @return Gpf_Rpc_Action
  */
 public function deleteFile(Gpf_Rpc_Params $params)
 {
     $action = new Gpf_Rpc_Action($params);
     $action->addOk();
     return $action;
 }
コード例 #28
0
 /**
  * @return Gpf_Rpc_Action
  */
 public function getAction()
 {
     $action = new Gpf_Rpc_Action(new Gpf_Rpc_Params());
     $action->loadFromObject($this->getStdResponse());
     return $action;
 }
コード例 #29
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;
 }
コード例 #30
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;
    }