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') );
}
}
//--
}