Exemplo n.º 1
0
         if ($tot_votes) {
             $pct = $cnt / $tot_votes * 100;
         }
         echo ' &bull; ' . $title . ' got ' . $cnt . ' votes (' . $pct . '%)<br/>';
         $list[] = array('name' => $title, 'value' => $cnt);
     }
     $pie = new Yui3PieChart();
     $pie->setWidth(100);
     $pie->setHeight(100);
     $pie->setCategoryKey('name');
     $pie->setDataSource($list);
     echo $pie->render();
     break;
 case 'remove':
     if (confirmed('Are you sure you want to remove this site poll?')) {
         PollItem::removePoll($this->child);
         js_redirect('a/polls/list');
     }
     break;
 case 'add':
     function addPoll($p)
     {
         if (empty($p['poll_q'])) {
             return;
         }
         if (!empty($p['poll_start_man'])) {
             $pollId = PollItem::addPollExactPeriod(SITE, 0, $p['poll_q'], $p['poll_start_man'], $p['poll_end_man']);
         } else {
             $pollId = PollItem::add(SITE, 0, $p['poll_q'], $p['poll_dur'], $p['poll_start']);
         }
         for ($i = 1; $i <= 8; $i++) {