Example #1
0
<?php

camp_load_translation_strings("plugin_debate");
// Check permissions
if (!$g_user->hasPermission('plugin_debate_admin')) {
    camp_html_display_error(getGS('You do not have the right to manage debates.'));
    exit;
}
$allLanguages = Language::GetLanguages();
$f_debate_nr = Input::Get('f_debate_nr', 'int');
$f_fk_language_id = Input::Get('f_fk_language_id', 'int');
$debate = new Debate($f_fk_language_id, $f_debate_nr);
if ($debate->exists()) {
    foreach ($debate->getTranslations() as $translation) {
        $existing[$translation->getLanguageId()] = true;
    }
    $title = $debate->getProperty('title');
    $question = $debate->getProperty('question');
    $is_used_as_default = false;
}
echo camp_html_breadcrumbs(array(array(getGS('Plugins'), $Campsite['WEBSITE_URL'] . '/admin/plugins/manage.php'), array(getGS('Debates'), $Campsite['WEBSITE_URL'] . '/admin/debate/index.php'), array(getGS('Translate Debate'), '')));
?>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" class="action_buttons" style="padding-top: 5px;">
<TR>
    <TD><A HREF="index.php"><IMG SRC="<?php 
echo $Campsite["ADMIN_IMAGE_BASE_URL"];
?>
/left_arrow.png" BORDER="0"></A></TD>
    <TD><A HREF="index.php"><B><?php 
putGS("Debate List");
?>
Example #2
0
 /**
  * Called when debate is deleted
  *
  * @param int $p_fk_debate_nr
  */
 public static function OnDebateDelete($p_fk_debate_nr)
 {
     if (count(Debate::getTranslations($p_debate_nr)) > 1) {
         return;
     }
     foreach (DebateSection::getAssignments($p_fk_debate_nr) as $record) {
         $record->delete();
     }
 }
Example #3
0
 public static function SyncNrOfAnswers($p_fk_language_id, $p_fk_debate_nr)
 {
     global $g_ado_db;
     $debate = new Debate($p_fk_language_id, $p_fk_debate_nr);
     if (count($debate->getTranslations()) > 1) {
         $nr_of_answers = $debate->getProperty('nr_of_answers');
         $query = "DELETE FROM   plugin_debate_answer\n                      WHERE         fk_debate_nr = {$p_fk_debate_nr}\n                                AND fk_language_id = {$p_fk_language_id}\n                                AND nr_answer > {$nr_of_answers}";
         $g_ado_db->execute($query);
         Debate::triggerStatistics($p_fk_debate_nr);
     }
 }