Exemple #1
0
     // Invite
 // Invite
 case QueryQuestion::OPTION_INVITE:
     $InviteQuery = Query::model()->findByPk($query_option);
     print $InviteQuery->name;
     break;
     // Culture Segment
 // Culture Segment
 case QueryQuestion::OPTION_CS:
     $CultureSegment = CultureSegment::model()->findByPk($query_option);
     print $CultureSegment->name;
     break;
     // Artforms
 // Artforms
 case QueryQuestion::OPTION_ARTFORM:
     $Artforms = Artform::model()->findByPk($query_option);
     print $Artform->title;
     // Level of engagement
 // Level of engagement
 case QueryQuestion::OPTION_LOE:
     $LevelsOfEngagement = QueryQuestion::model()->levelsOfEngagement();
     foreach ($LevelsOfEngagement as $LOEid => $LOEName) {
         if ($query_option == $LOEid) {
             print $LOEName;
         }
     }
     break;
     // Campaign
 // Campaign
 case QueryQuestion::OPTION_CAMPAIGN:
     $Campaign = Campaign::model()->findByPk($query_option);
Exemple #2
0
     break;
 case QueryQuestion::OPTION_INVITE:
     if (is_null($InviteQueries)) {
         $InviteQueries = Query::model()->findAll(array('condition' => 'invite = 1', 'index' => 'id'));
     }
     print ' ' . $InviteQueries[$row->query_option]->name;
     break;
 case QueryQuestion::OPTION_CS:
     if (is_null($CultureSegments)) {
         $CultureSegments = CultureSegment::model()->findAll(array('index' => 'id'));
     }
     print ' ' . $CultureSegments[$row->query_option]->name;
     break;
 case QueryQuestion::OPTION_ARTFORM:
     if (is_null($Artforms)) {
         $Artforms = Artform::model()->findAll(array('index' => 'id', 'order' => 'title ASC'));
     }
     print ' ' . $CultureSegments[$row->query_option]->title;
     break;
 case QueryQuestion::OPTION_LOE:
     if (is_null($LevelsOfEngagement)) {
         $LevelsOfEngagement = QueryQuestion::model()->levelsOfEngagement();
     }
     print ' ' . $LevelsOfEngagement[$row->query_option];
     break;
 case QueryQuestion::OPTION_CAMPAIGN:
     if (is_null($Campaigns)) {
         $Campaigns = Campaign::model()->with('query')->findAll(array('condition' => 'invite = 0', 'index' => 'id'));
     }
     print ' ' . $Campaigns[$row->query_option];
     break;
Exemple #3
0
 public function actionStepSeven()
 {
     $this->inAccession = true;
     $Accession = $this->getAccessionRecord();
     $this->checkStep($Accession, 7);
     $this->pageTitle = 'Visited Artforms | Accession';
     $Artforms = Artform::model()->findAll();
     if (isset($_POST['submit-artforms'])) {
         if (sizeof($_POST['Artforms']) < sizeof($Artforms)) {
             $Accession->addError('id', 'You must answer all the questions');
         } else {
             foreach ($_POST['Artforms'] as $artform_id => $visited) {
                 // Record already exists?
                 $Contact2Artform = Contact2Artform::model()->find(array('condition' => 'accession_id = :accession_id AND artform_id = :artform_id', 'params' => array(':accession_id' => $Accession->id, ':artform_id' => $artform_id)));
                 if (!is_null($Contact2Artform)) {
                     // Update the exisiting record
                     $Contact2Artform->visited = $visited;
                     $Contact2Artform->save(true, array('visited'));
                 } else {
                     $Contact2Artform = new Contact2Artform();
                     $Contact2Artform->accession_id = $Accession->id;
                     $Contact2Artform->artform_id = $artform_id;
                     $Contact2Artform->visited = $visited;
                     if (!$Contact2Artform->save()) {
                         print_r($Contact2Artform->errors);
                         exit;
                     }
                 }
             }
             $this->updateStep($Accession, 7);
             $this->redirect(array('accession/complete', 'accessionhash' => $Accession->accession_hash));
         }
         $visitedArtforms = $_POST['Artforms'];
     } else {
         // Get existing choices
         $Contact2Artforms = Contact2Artform::model()->findAll(array('condition' => 'accession_id = :accession_id', 'params' => array(':accession_id' => $Accession->id)));
         $visitedArtforms = array();
         foreach ($Contact2Artforms as $visitedArtform) {
             $visitedArtforms[$visitedArtform->artform_id] = $visitedArtform->visited;
         }
     }
     $this->render('step7', array('Accession' => $Accession, 'progress' => 7, 'Artforms' => $Artforms, 'visitedArtforms' => $visitedArtforms));
 }