Fermé

Dolphin 7: Create a predefined Poll from another module??

Hi,

I am working on a modification for a custom module in Dolphin 7 using the existing Poll module...

What I need to do is run a php/javascript function to create a poll with predefined questions and answers.

I want to add this function to another module (LiveStream from Video Whisper) code, but being new to dolphin I dont know how to include other module functions within its own. I think I would have to include a core file from the Poll module in order for this function to work.

I need to accomplished two things:

1) Create a new poll when the "Add room" form is submitted.

- I have a simple "if" statement that will only run if the LiveStream modules Add form is successfully submitted. If the form successfully submits the statement will run a custom function from the [url removed, login to view] file ("autocreatepoll"). *This custom function is the same as the original createpoll function that is found in that file at line 2062, but Im working on modifications to create the predefine question and answers. The function is explained in # 2...

2) Give the newly created poll a predefined question and answers.

- I created a custom function call autocreatepoll, which is based on the original createpoll function of the [url removed, login to view] file.

For the modifications, I want to create a predefined question and answers for the new poll whenever the form is successfully submitted. This is what I have so far...

function autocreatePoll($sPollQuestion, $sPollAnswers, $iCommentGroupValue, $iVoteGroupValue, $sCategory, $iViewGroupValue)

{

// Predefined function arguments

$sPollQuestion = 'How would you rate this?';

$sPollAnswers = array (1, 2, 3, 4, 5); // For standard rating from 1 to 5

$iCommentGroupValue = 3;

$iVoteGroupValue = 3;

$sCategory = 'Videos';

$iViewGroupValue = 3;

// Everything below is unchanged

// check membership;

if(!$this -> isPollCreateAlowed($this -> aPollSettings['member_id'], true) ) {

return;

}

// ** init some needed variables ;

$aPoolInfo = array();

if ( !$sPollQuestion or !$sPollAnswers ) {

$this -> sActionAnswer = MsgBox(POLL_EMPTY_FIELDS);

}

else {

$aPoolInfo = array

(

'owner_id' => $this -> aPollSettings['member_id'],

'question' => $sPollQuestion,

'answers' => $sPollAnswers,

'results' => $sPollResults,

'tags' => $sTags,

'allow_comment' => $iCommentGroupValue,

'allow_vote' => $iVoteGroupValue,

'category' => $sCategory,

'allow_view' => $iViewGroupValue

);

$iResponse = $this -> _oDb -> createPoll($aPoolInfo, $this -> aPollSettings['admin_mode']);

$iLastPoll = $this -> _oDb -> lastId();

// define the action number ;

switch($iResponse) {

case '0':

$this -> sActionAnswer = MsgBox(POLL_NOT_ALLOW);

break;

case '1' :

$this -> sActionAnswer = MsgBox(POLL_CREATED);

// create system event

$oZ = new BxDolAlerts('bx_poll', 'add', $iLastPoll);

$oZ->alert();

$oTag = new BxDolTags();

$oTag -> reparseObjTags('bx_poll', $iLastPoll);

$oCateg = new BxDolCategories();

$oCateg->reparseObjTags('bx_poll', $iLastPoll);

break;

case '2' :

$this -> sActionAnswer = MsgBox(POLL_MAX_REACHED);

break;

}

}

}

I have attached the two files for references. Basically I just want to be able to create a new poll from the existing Poll module, from the LiveStream module when a new "Add Room" (LiveStream function) form is submitted.

Thanks a lot

Compétences : HTML, PHP, Design de site internet

Voir plus : what i need to create a website, what do i need to create a website, what do i need in order to create website design, true results, i want to design and create a website, i want 2 create website, how would you create a website, how to design a room, how to create a new website, how to create a design, how do you create a website, custom case website design, code on how to create a website, answers from, dolphin php poll module, php create function, how to create a website c#, how do i create a website, video php whisper, poll, oz, i want to create a website, i need to create a video, how to create a website, how create a website

Concernant l'employeur :
( 0 commentaires ) Miami, United States

N° du projet : #2354632

1 freelance a fait une offre moyenne de 150 $ pour ce travail

hitenmark

Hello sir, Please Check PMB

150 $ USD en 5 jours
(0 Commentaires)
0.0