creating an action in the standard members

I am trying to create an extra action in the actions list of membership levels list, let me explain my goal:

 

I have included a survey module and it shows the results online. This is accessed within the Actions block on the module.

Unfortunately everyone can see the results at any time. I want the Admin only to see the results. Can this be achieved by a tick box in the membership levels list within the actions?

Quote · 12 Jan 2012

umm!! i think it can be achieved by adding something like this in the block code or somewhere else in the module's code.

 if(!isAdmin()) {

echo "want to see the result? You are not an admin! I will give you a punch, go away!!!!";

}

else {

//your module code. blah blah blah. ..:)

}

can't tell exact place without looking in it.

so much to do....
Quote · 12 Jan 2012

thanks trying to work out how best to do this or which code i will post the code below for the survey view:

 

 

<?php
 
    bx_import('BxDolPageView');
    bx_import('BxTemplVotingView');
    bx_import('BxTemplCmtsView');

    class SasSurveyView extends BxDolPageView
    {
        // contain link on current module's object;
        var $oModule;

        var $oVotingView;
        var $oCmtsView;
  var $aSurveyInfo;

        /**
         * Class constructor;
         *
         * @param $sPageName string
         * @param $oSurveyModule object
         */
        function SasSurveyView($sPageName, $oSurveyModule, $aSurveyInfo = array())
        {
            parent::BxDolPageView($sPageName);
            $this -> oModule = $oSurveyModule;
            $this -> aSurveyInfo = $aSurveyInfo;

            $GLOBALS['oTopMenu']->setCustomBreadcrumbs(
             array(
              _t('_sas_survey') => BX_DOL_URL_ROOT . $this -> oModule -> sPathToModule . 'get/home',
           $aSurveyInfo['title'] => '',
          )
         );

            if( isset($_GET['view_all']) ) {
          unset($_GET['view_all']);
         }
         else if($_POST['view_all']) {
          unset($_POST['view_all']);
         }
        }

        //-- View functions --//

        /**
         * Get list of survey's actions
         *
         * @return text
         */
        
         /*our code that we messed up possibly !*/
          if (isset($Memb) > 2) {
         else()
         /*end ofmess up */
        function getBlockCode_Actions()
        { 
            $aOwnerInfo = getProfileInfo($this -> aSurveyInfo['owner']);

            // prepare all needed keys
            $aOwnerInfo['BaseUri']     =  BX_DOL_URL_ROOT . $this -> oModule -> _oConfig -> getBaseUri();
            $aOwnerInfo['SurveyId']    =  $this -> aSurveyInfo['id'];

   return $GLOBALS['oFunctions']
             -> genObjectsActions($aOwnerInfo, $this -> oModule -> _oConfig -> sSystemPrefix);
        }

        /**
         * Get owner info
         *
         * @return text
         */
        function getBlockCode_OwnerInfo()
        {
   return  $this -> oModule -> getSurveyOwnerBlock($this -> aSurveyInfo);
        }

     /**
         * Get comments
         *
         * @return text
         */
        function getBlockCode_Comments()
        {
         $oCmtsView   = new BxTemplCmtsView($this -> oModule -> _oConfig -> sSystemPrefix
          , $this -> aSurveyInfo['id']);

           $sOutputCode  = $oCmtsView  -> getExtraCss();
         $sOutputCode .= $oCmtsView  -> getExtraJs();
 
         $sOutputCode .= ( !$oCmtsView -> isEnabled() )
    ? ''
             : $oCmtsView -> getCommentsFirst();

         return $sOutputCode;
        }
       
     /**
         * Get rate
         *
         * @return text
         */
        function getBlockCode_Rate()
        {
   $oVotingView = new BxTemplVotingView ($this -> oModule -> _oConfig -> sSystemPrefix
          , $this -> aSurveyInfo['id']);
          
            return $oVotingView -> isEnabled()
             ? $oVotingView -> getBigVoting()
                : '';
        }

        /**
         * Get survey
         *
         * @return text
         */
        function getBlockCode_Survey()
        {
         if(!$this -> oModule -> _oDb -> isAlreadyVoted($this -> oModule -> iLoggedId
          ,  $this -> aSurveyInfo['id'])) {

          if( false != bx_get('finished') ) {
           // put member id in vote track
           $this -> oModule -> _oDb
            -> creatVoteTrack($this -> oModule -> iLoggedId,  $this -> aSurveyInfo['id']);
 
           return MsgBox( _t('_sas_survey_held_survey',
              BX_DOL_URL_ROOT . $this -> oModule -> sPathToModule
                . 'analyze/' .  $this -> aSurveyInfo['id']) );
          }
          else {
           //-- process recived answers --//
           if( false != bx_get('survey') && false != bx_get('page_uid') ) {
            return $this -> oModule
             -> processAnswers( $this -> aSurveyInfo, bx_get('survey'), bx_get('page_uid') );
           }
           else {
      return $this -> oModule -> getSurveyDecorationForm($this -> aSurveyInfo);
           }
          }
         }
         else {
          //profile alredy voted
          return MsgBox( _t('_sas_survey_already_voted') );
         }
        }
        //--
    }

Quote · 12 Jan 2012

seeing only this file will not help. you can use the code directly in the page block if you wish, it will display a message to the user but you can view it normally. 

pm me if you need help.

so much to do....
Quote · 12 Jan 2012
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.