Removed polls module as default

This commit is contained in:
Lucas Bartholemy 2014-07-02 07:37:40 +02:00
parent 1336b6d864
commit 123a9c0a50
29 changed files with 12 additions and 1987 deletions

View File

@ -20,11 +20,11 @@
/**
* Module Manager
*
*
* - Starts module autostart files
* - Handles enabled modules
* - Modules autostarts.php registers to it for events & co
*
* - Modules autostarts.php registers to it for events & co
*
*/
class ModuleManager extends CApplicationComponent
{
@ -33,15 +33,15 @@ class ModuleManager extends CApplicationComponent
/**
* List of all enabled module ids
*
*
* @var Array
*/
private $enabledModules = array();
/**
* Array of installed modules populated on autostart.php register
*
* @var Array moduleId => moduleClass
*
* @var Array moduleId => moduleClass
*/
private $installedModules = array();
@ -122,7 +122,7 @@ class ModuleManager extends CApplicationComponent
require_once($autoloadFile);
// Cache content of autostart file
// Cache content of autostart file
if ($cacheEnabled) {
$cacheFileContent .= file_get_contents($autoloadFile);
}
@ -154,12 +154,12 @@ class ModuleManager extends CApplicationComponent
/**
* Registers a module
* This is usally called in the autostart file of the module.
*
*
* - id
* - class Module Base Class
* - import Global Module Imports
* - import Global Module Imports
* - events Events to catch
*
*
* - isCoreModule Core Modules only
*
* @param Array $definition
@ -204,7 +204,7 @@ class ModuleManager extends CApplicationComponent
/**
* Returns Module Base Class of installed module neither when not enabled.
*
*
* @param String $id Module Id
* @return HWebModule
*/
@ -227,7 +227,7 @@ class ModuleManager extends CApplicationComponent
/**
* Returns a list of all installed modules
*
*
* @param boolean $includeCoreModules include also core modules
* @param boolean $returnClassName instead of instance
* @return Array of installed Modules
@ -305,11 +305,6 @@ class ModuleManager extends CApplicationComponent
public function canUninstall($moduleId)
{
// Some Core Module cannot be uninstalled
if (in_array($moduleId, array('polls', 'tasks', 'yiigii', 'mail'))) {
return false;
}
if ($this->isInstalled($moduleId)) {
$module = $this->getModule($moduleId);

View File

@ -1,103 +0,0 @@
<?php
/**
* PollsModule is the WebModule for the polling system.
*
* This class is also used to process events catched by the autostart.php listeners.
*
* @package humhub.modules.polls
* @since 0.5
* @author Luke
*/
class PollsModule extends HWebModule
{
/**
* Inits the Module
*/
public function init()
{
$this->setImport(array(
'polls.models.*',
'polls.behaviors.*',
));
}
public function behaviors()
{
return array(
'SpaceModuleBehavior' => array(
'class' => 'application.modules_core.space.SpaceModuleBehavior',
),
);
}
/**
* On global module disable, delete all created content
*/
public function disable()
{
if (parent::disable()) {
foreach (Content::model()->findAllByAttributes(array('object_model' => 'Poll')) as $content) {
$content->delete();
}
return true;
}
return false;
}
/**
* On disabling this module on a space, deleted all module -> space related content/data.
* Method stub is provided by "SpaceModuleBehavior"
*
* @param Space $space
*/
public function disableSpaceModule(Space $space)
{
foreach (Content::model()->findAllByAttributes(array('space_id' => $space->id, 'object_model' => 'Poll')) as $content) {
$content->delete();
}
}
/**
* On build of a Space Navigation, check if this module is enabled.
* When enabled add a menu item
*
* @param type $event
*/
public static function onSpaceMenuInit($event)
{
$space = Yii::app()->getController()->getSpace();
// Is Module enabled on this workspace?
if ($space->isModuleEnabled('polls')) {
$event->sender->addItem(array(
'label' => Yii::t('PollsModule.base', 'Polls'),
'group' => 'modules',
'url' => Yii::app()->createUrl('//polls/poll/show', array('sguid' => $space->guid)),
'icon' => '<i class="fa fa-question-circle"></i>',
'isActive' => (Yii::app()->controller->module && Yii::app()->controller->module->id == 'polls'),
));
}
}
/**
* On User delete, delete all poll answers by this user
*
* @param type $event
*/
public static function onUserDelete($event)
{
foreach (PollAnswerUser::model()->findAllByAttributes(array('created_by' => $event->sender->id)) as $question) {
$question->delete();
}
return true;
}
}

View File

@ -1,49 +0,0 @@
<?php
/**
* PollsStreamAction is modified version of the StreamAction to show only objects
* of type Poll.
*
* This Action is inserted in PollController and shows with interaction of the
* PollStreamWidget the Poll Stream.
*
* @package humhub.modules.polls
* @since 0.5
* @author Luke
*/
class PollsStreamAction extends StreamAction {
/**
* Inject Question Specific SQL
*/
protected function prepareSQL() {
$this->sqlWhere .= " AND object_model='Poll'";
parent::prepareSQL();
}
/**
* Handle Question Specific Filters
*/
protected function setupFilterSQL() {
if (in_array('polls_notAnswered', $this->filters) || in_array('polls_mine', $this->filters)) {
$this->sqlJoin .= " LEFT JOIN poll ON content.object_id=poll.id AND content.object_model = 'Poll'";
if (in_array('polls_notAnswered', $this->filters)) {
$this->sqlJoin .= " LEFT JOIN poll_answer_user ON poll.id=poll_answer_user.poll_id AND poll_answer_user.created_by = '" . Yii::app()->user->id . "'";
$this->sqlWhere .= " AND poll_answer_user.id is null";
}
#if (in_array('questions_mine', $this->filters)) {
# $this->sqlWhere .= " AND question.created_by = '".Yii::app()->user->id."'";
#}
}
parent::setupFilterSQL();
}
}
?>

View File

@ -1,18 +0,0 @@
<?php
Yii::app()->moduleManager->register(array(
'id' => 'polls',
'class' => 'application.modules.polls.PollsModule',
'import' => array(
'application.modules.polls.models.*',
'application.modules.polls.behaviors.*',
'application.modules.polls.notifications.*',
'application.modules.polls.*',
),
// Events to Catch
'events' => array(
array('class' => 'User', 'event' => 'onBeforeDelete', 'callback' => array('PollsModule', 'onUserDelete')),
array('class' => 'SpaceMenuWidget', 'event' => 'onInit', 'callback' => array('PollsModule', 'onSpaceMenuInit')),
),
));
?>

View File

@ -1,223 +0,0 @@
<?php
/**
* PollController handles all poll related actions.
*
* @package humhub.modules.polls.controllers
* @since 0.5
* @author Luke
*/
class PollController extends Controller {
public $subLayout = "application.modules_core.space.views.space._layout";
/**
* @return array action filters
*/
public function filters() {
return array(
'accessControl', // perform access control for CRUD operations
);
}
/**
* Specifies the access control rules.
* This method is used by the 'accessControl' filter.
* @return array access control rules
*/
public function accessRules() {
return array(
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'users' => array('@'),
),
array('deny', // deny all users
'users' => array('*'),
),
);
}
/**
* Add mix-ins to this model
*
* @return type
*/
public function behaviors() {
return array(
'SpaceControllerBehavior' => array(
'class' => 'application.modules_core.space.SpaceControllerBehavior',
),
);
}
/**
* Actions
*
* @return type
*/
public function actions() {
return array(
// Adds the PollsStreamAction Module to add own Streaming/Walling
// for Polls Only Objects.
'stream' => array(
'class' => 'application.modules.polls.PollsStreamAction',
'mode' => 'normal',
),
);
}
/**
* Shows the questions tab
*/
public function actionShow() {
$this->render('show', array());
}
/**
* Posts a new question throu the question form
*
* @return type
*/
public function actionCreate() {
$this->forcePostRequest();
$_POST = Yii::app()->input->stripClean($_POST);
$poll = new Poll();
$poll->content->populateByForm();
$poll->question = Yii::app()->request->getParam('question');
$poll->answersText = Yii::app()->request->getParam('answersText');
$poll->allow_multiple = Yii::app()->request->getParam('allowMultiple');
// get user guids from notify input
$poll->userToNotify = Yii::app()->request->getParam('notifiyUserInput');
if ($poll->validate()) {
$poll->save();
$this->renderJson(array('wallEntryId' => $poll->content->getFirstWallEntryId()));
} else {
$this->renderJson(array('errors' => $poll->getErrors()), false);
}
}
/**
* Answers a polls
*/
public function actionAnswer() {
$poll = $this->getPollByParameter();
$answers = Yii::app()->request->getParam('answers');
// Build array of answer ids
$votes = array();
if (is_array($answers)) {
foreach ($answers as $answer_id => $flag) {
$votes[] = (int) $answer_id;
}
} else {
$votes[] = $answers;
}
if (count($votes) > 1 && !$poll->allow_multiple) {
throw new CHttpException(401, Yii::t('PollsModule.base', 'Voting for multiple answers is disabled!'));
}
$poll->vote($votes);
$this->getPollOut($poll);
}
/**
* Resets users question answers
*/
public function actionAnswerReset() {
$poll = $this->getPollByParameter();
$poll->resetAnswer();
$this->getPollOut($poll);
}
/**
* Returns a user list including the pagination which contains all results
* for an answer
*/
public function actionUserListResults() {
$poll = $this->getPollByParameter();
$answerId = (int) Yii::app()->request->getQuery('answerId', '');
$answer = PollAnswer::model()->findByPk($answerId);
if ($answer == null || $poll->id != $answer->poll_id) {
throw new CHttpException(401, Yii::t('PollsModule.base', 'Invalid answer!'));
}
$page = (int) Yii::app()->request->getParam('page', 1);
$total = PollAnswerUser::model()->count('poll_answer_id=:aid', array(':aid' => $answerId));
$usersPerPage = HSetting::Get('paginationSize');
$sql = "SELECT u.* FROM `poll_answer_user` a " .
"LEFT JOIN user u ON a.created_by = u.id " .
"WHERE a.poll_answer_id=:aid AND u.status=" . User::STATUS_ENABLED . " " .
"ORDER BY a.created_at DESC " .
"LIMIT " . ($page - 1) * $usersPerPage . "," . $usersPerPage;
$params = array(':aid' => $answerId);
$pagination = new CPagination($total);
$pagination->setPageSize($usersPerPage);
$users = User::model()->findAllBySql($sql, $params);
$output = $this->renderPartial('application.modules_core.user.views._listUsers', array(
'title' => Yii::t('PollsModule.base', "Users voted for: <strong>{answer}</strong>", array('{answer}' => $answer->answer)),
'users' => $users,
'pagination' => $pagination
), true);
Yii::app()->clientScript->render($output);
echo $output;
Yii::app()->end();
}
/**
* Prints the given poll wall output include the affected wall entry id
*
* @param Poll $poll
*/
private function getPollOut($question) {
// Set correct wall type
$wallType = Yii::app()->request->getParam('wallType');
if ($wallType != "" && ($wallType == 'Space' || $wallType == 'Dashboard' || $wallType == 'User'))
Wall::$currentType = $wallType;
$output = $question->getWallOut();
Yii::app()->clientScript->render($output);
$json = array();
$json['output'] = $output;
$json['wallEntryId'] = $question->content->getFirstWallEntryId(); // there should be only one
echo CJSON::encode($json);
Yii::app()->end();
}
/**
* Returns a given poll by given request parameter.
*
* This method also validates access rights of the requested poll object.
*/
private function getPollByParameter() {
// Try load space, this also checks access rights and such things
//$space = $this->getSpace();
$pollId = (int) Yii::app()->request->getParam('pollId');
$poll = Poll::model()->findByPk($pollId);
if ($poll == null) {
throw new CHttpException(401, Yii::t('PollsModule.base', 'Could not load poll!'));
}
if (!$poll->content->canRead()) {
throw new CHttpException(401, Yii::t('PollsModule.base', 'You have insufficient permissions to perform that operation!'));
}
return $poll;
}
}

View File

@ -1,50 +0,0 @@
<?php
/**
* Message translations.
*
* This file is automatically generated by 'yiic message' command.
* It contains the localizable messages extracted from source code.
* You may modify this file by translating the extracted messages.
*
* Each array element represents the translation (value) of a message (key).
* If the value is empty, the message is considered as not translated.
* Messages that no longer need translation will have their translations
* enclosed between a pair of '@@' marks.
*
* Message string can be used with plural forms format. Check i18n section
* of the guide for details.
*
* NOTE, this file must be saved in UTF-8 encoding.
*/
return array (
'Adds polling features to spaces.' => '',
'Adds polling features to your space.' => '',
'Allow multiple answers per user?' => '',
'Ask something...' => '',
'Asked by me' => '',
'Could not load poll!' => '',
'Display all' => '',
'Go to poll...' => '',
'Invalid answer!' => '',
'No answered yet' => '',
'No poll found which matches your current filter(s)!' => '',
'Only private polls' => '',
'Only public polls' => '',
'Polls' => '',
'Possible answers (one per line)' => '',
'Question' => '',
'Reset my vote' => '',
'There are no polls yet!' => '',
'This is a public poll (also non-members)' => '',
'Users voted for: {answer}' => '',
'Vote' => '',
'Vote now...' => '',
'Voting for multiple answers is disabled!' => '',
'You have insufficient permissions to perform that operation!' => '',
'and {count} more vote for this.' => '',
'answered question' => '',
'asked the question:' => '',
'created a new poll' => '',
'voted in question' => '',
'votes' => '',
);

View File

@ -1,50 +0,0 @@
<?php
/**
* Message translations.
*
* This file is automatically generated by 'yiic message' command.
* It contains the localizable messages extracted from source code.
* You may modify this file by translating the extracted messages.
*
* Each array element represents the translation (value) of a message (key).
* If the value is empty, the message is considered as not translated.
* Messages that no longer need translation will have their translations
* enclosed between a pair of '@@' marks.
*
* Message string can be used with plural forms format. Check i18n section
* of the guide for details.
*
* NOTE, this file must be saved in UTF-8 encoding.
*/
return array (
'Adds polling features to spaces.' => '',
'Adds polling features to your space.' => '',
'Allow multiple answers per user?' => '',
'Ask something...' => '',
'Asked by me' => '',
'Could not load poll!' => '',
'Display all' => '',
'Go to poll...' => '',
'Invalid answer!' => '',
'No answered yet' => '',
'No poll found which matches your current filter(s)!' => '',
'Only private polls' => '',
'Only public polls' => '',
'Polls' => '',
'Possible answers (one per line)' => '',
'Question' => '',
'Reset my vote' => '',
'There are no polls yet!' => '',
'This is a public poll (also non-members)' => '',
'Users voted for: {answer}' => '',
'Vote' => '',
'Vote now...' => '',
'Voting for multiple answers is disabled!' => '',
'You have insufficient permissions to perform that operation!' => '',
'and {count} more vote for this.' => '',
'answered question' => '',
'asked the question:' => '',
'created a new poll' => '',
'voted in question' => '',
'votes' => '',
);

View File

@ -1,50 +0,0 @@
<?php
/**
* Message translations.
*
* This file is automatically generated by 'yiic message' command.
* It contains the localizable messages extracted from source code.
* You may modify this file by translating the extracted messages.
*
* Each array element represents the translation (value) of a message (key).
* If the value is empty, the message is considered as not translated.
* Messages that no longer need translation will have their translations
* enclosed between a pair of '@@' marks.
*
* Message string can be used with plural forms format. Check i18n section
* of the guide for details.
*
* NOTE, this file must be saved in UTF-8 encoding.
*/
return array (
'Adds polling features to spaces.' => '',
'Adds polling features to your space.' => '',
'Allow multiple answers per user?' => '',
'Ask something...' => '',
'Asked by me' => '',
'Could not load poll!' => '',
'Display all' => '',
'Go to poll...' => '',
'Invalid answer!' => '',
'No answered yet' => '',
'No poll found which matches your current filter(s)!' => '',
'Only private polls' => '',
'Only public polls' => '',
'Polls' => '',
'Possible answers (one per line)' => '',
'Question' => '',
'Reset my vote' => '',
'There are no polls yet!' => '',
'This is a public poll (also non-members)' => '',
'Users voted for: {answer}' => '',
'Vote' => '',
'Vote now...' => '',
'Voting for multiple answers is disabled!' => '',
'You have insufficient permissions to perform that operation!' => '',
'and {count} more vote for this.' => '',
'answered question' => '',
'asked the question:' => '',
'created a new poll' => '',
'voted in question' => '',
'votes' => '',
);

View File

@ -1,53 +0,0 @@
<?php
class m131023_165921_initial extends EDbMigration {
public function up() {
$this->createTable('poll', array(
'id' => 'pk',
'question' => 'varchar(255) NOT NULL',
'allow_multiple' => 'tinyint(4) NOT NULL',
'created_at' => 'datetime NOT NULL',
'created_by' => 'int(11) NOT NULL',
'updated_at' => 'datetime NOT NULL',
'updated_by' => 'int(11) NOT NULL',
), '');
$this->createTable('poll_answer', array(
'id' => 'pk',
'poll_id' => 'int(11) NOT NULL',
'answer' => 'varchar(255) NOT NULL',
'created_at' => 'datetime NOT NULL',
'created_by' => 'int(11) NOT NULL',
'updated_at' => 'datetime NOT NULL',
'updated_by' => 'int(11) NOT NULL',
), '');
$this->createTable('poll_answer_user', array(
'id' => 'pk',
'poll_id' => 'int(11) NOT NULL',
'poll_answer_id' => 'int(11) NOT NULL',
'created_at' => 'datetime NOT NULL',
'created_by' => 'int(11) NOT NULL',
'updated_at' => 'datetime NOT NULL',
'updated_by' => 'int(11) NOT NULL',
), '');
}
public function down() {
echo "m131023_165921_initial does not support migration down.\n";
return false;
}
/*
// Use safeUp/safeDown to do migration with transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@ -1,14 +0,0 @@
<?php
class m131030_122743_longer_questions extends ZDbMigration {
public function up() {
$this->alterColumn('poll', 'question', 'TEXT NOT NULL');
}
public function down() {
echo "m131030_122743_longer_questions does not support migration down.\n";
return false;
}
}

View File

@ -1,289 +0,0 @@
<?php
/**
* This is the model class for table "poll".
*
* The followings are the available columns in table 'poll':
*
* @property integer $id
* @property string $question
* @property integer $allow_multiple
* @property string $created_at
* @property integer $created_by
* @property string $updated_at
* @property integer $updated_by
*
* @package humhub.modules.polls.models
* @since 0.5
* @author Luke
*/
class Poll extends HActiveRecordContent
{
const MIN_REQUIRED_ANSWERS = 2;
public $userToNotify = "";
public $answersText;
public $autoAddToWall = true;
/**
* Returns the static model of the specified AR class.
* @param string $className active record class name.
* @return Question the static model class
*/
public static function model($className = __CLASS__)
{
return parent::model($className);
}
/**
* @return string the associated database table name
*/
public function tableName()
{
return 'poll';
}
/**
* @return array validation rules for model attributes.
*/
public function rules()
{
return array(
array('question, answersText, created_at, created_by, updated_at, updated_by', 'required'),
array('answersText', 'validateAnswersText'),
array('allow_multiple, created_by, updated_by', 'numerical', 'integerOnly' => true),
array('question', 'length', 'max' => 600),
);
}
/**
* @return array customized attribute labels (name=>label)
*/
public function attributeLabels()
{
return array(
'answersText' => Yii::t('PollsModule.base', 'Answers'),
'question' => Yii::t('PollsModule.base', 'Question'),
'allow_multiple' => Yii::t('PollsModule.base', 'Multiple answers per user'),
);
}
/**
* @return array relational rules.
*/
public function relations()
{
return array(
'answers' => array(self::HAS_MANY, 'PollAnswer', 'poll_id'),
);
}
public function afterSave()
{
parent::afterSave();
if ($this->isNewRecord) {
// Set Answers
$answers = explode("\n", $this->answersText);
foreach ($answers as $answerText) {
$answer = new PollAnswer();
$answer->poll_id = $this->id;
$answer->answer = Yii::app()->input->stripClean($answerText);
$answer->save();
}
// Create Question Created Activity
$activity = Activity::CreateForContent($this);
$activity->type = "PollCreated";
$activity->module = "polls";
$activity->save();
$activity->fire();
// notify assigned Users
if ($this->userToNotify != "") {
$guids = explode(",", $this->userToNotify);
foreach ($guids as $guid) {
$guid = trim($guid);
$user = User::model()->findByAttributes(array('guid' => $guid));
if ($user != null) {
$this->notifyUser($user);
}
}
}
}
return true;
}
/**
* Deletes a Poll including its dependencies.
*/
public function beforeDelete()
{
// Delete all dependencies
foreach ($this->answers as $answer) {
foreach ($answer->votes as $answerUser) {
$answerUser->delete();
}
$answer->delete();
}
Notification::remove('Poll', $this->id);
return parent::beforeDelete();
}
/**
* Checks if user has voted
*
* @param type $userId
* @return type
*/
public function hasUserVoted($userId = "")
{
if ($userId == "")
$userId = Yii::app()->user->id;
$answer = PollAnswerUser::model()->findByAttributes(array('created_by' => $userId, 'poll_id' => $this->id));
if ($answer == null)
return false;
return true;
}
public function vote($votes = array())
{
if ($this->hasUserVoted()) {
return;
}
$voted = false;
foreach ($votes as $answerId) {
$answer = PollAnswer::model()->findByAttributes(array('id' => $answerId, 'poll_id' => $this->id));
$userVote = new PollAnswerUser();
$userVote->poll_id = $this->id;
$userVote->poll_answer_id = $answer->id;
if ($userVote->save()) {
$voted = true;
}
}
if ($voted) {
// Create Question Answered Activity
$activity = Activity::CreateForContent($this);
$activity->type = "PollAnswered";
$activity->module = "polls";
$activity->save();
$activity->fire();
}
}
/**
* Resets all answers from a user
*
* @param type $userId
*/
public function resetAnswer($userId = "")
{
if ($userId == "")
$userId = Yii::app()->user->id;
if ($this->hasUserVoted($userId)) {
$answers = PollAnswerUser::model()->findAllByAttributes(array('created_by' => $userId, 'poll_id' => $this->id));
foreach ($answers as $answer) {
$answer->delete();
}
// Delete Activity for Question Answered
$activity = Activity::model()->findByAttributes(array(
'type' => 'PollAnswered',
'object_model' => "Poll",
'created_by' => $userId,
'object_id' => $this->id
));
if ($activity)
$activity->delete();
}
}
public function setAnswers()
{
}
/**
* Returns the Wall Output
*/
public function getWallOut()
{
return Yii::app()->getController()->widget('application.modules.polls.widgets.PollWallEntryWidget', array('poll' => $this), true);
}
/**
* Returns a title/text which identifies this IContent.
*
* e.g. Post: foo bar 123...
*
* @return String
*/
public function getContentTitle()
{
return Yii::t('PollsModule.base', "Question") . " \"" . Helpers::truncateText($this->question, 25) . "\"";
}
public function validateAnswersText()
{
$answers = explode("\n", $this->answersText);
$answerCount = 0;
$answerTextNew = "";
foreach ($answers as $answer) {
if (trim($answer) != "") {
$answerCount++;
$answerTextNew .= $answer . "\n";
}
}
if ($answerCount < self::MIN_REQUIRED_ANSWERS) {
$this->addError('answersText', Yii::t('PollsModule.base', "Please specify at least {min} answers!", array("{min}" => self::MIN_REQUIRED_ANSWERS)));
}
$this->answersText = $answerTextNew;
}
/**
* Assign user to this poll
*/
public function notifyUser($user = "")
{
if ($user == "") {
$user = Yii::app()->user->getModel();
}
// Fire Notification to user
$notification = new Notification();
$notification->class = "PollCreatedNotification";
$notification->user_id = $user->id; // Assigned User
$notification->space_id = $this->content->space_id;
$notification->source_object_model = 'Poll';
$notification->source_object_id = $this->id;
$notification->target_object_model = 'Poll';
$notification->target_object_id = $this->id;
$notification->save();
}
}

View File

@ -1,85 +0,0 @@
<?php
/**
* This is the model class for table "poll_answer".
*
* The followings are the available columns in table 'poll_answer':
* @property integer $id
* @property integer $question_id
* @property string $answer
* @property string $created_at
* @property integer $created_by
* @property string $updated_at
* @property integer $updated_by
*
* @package humhub.modules.polls.models
* @since 0.5
* @author Luke
*/
class PollAnswer extends HActiveRecord {
/**
* Returns the static model of the specified AR class.
* @param string $className active record class name.
* @return QuestionAnswer the static model class
*/
public static function model($className = __CLASS__) {
return parent::model($className);
}
/**
* @return string the associated database table name
*/
public function tableName() {
return 'poll_answer';
}
/**
* @return array validation rules for model attributes.
*/
public function rules() {
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('poll_id, answer, created_at, created_by, updated_at, updated_by', 'required'),
array('poll_id, created_by, updated_by', 'numerical', 'integerOnly' => true),
array('answer', 'length', 'max' => 255),
);
}
/**
* @return array relational rules.
*/
public function relations() {
return array(
'poll' => array(self::BELONGS_TO, 'Poll', 'id'),
'votes' => array(self::HAS_MANY, 'PollAnswerUser', 'poll_answer_id'),
);
}
/**
* Returns the percentage of users voted for this answer
*
* @return int
*/
public function getPercent() {
$total = PollAnswerUser::model()->countByAttributes(array('poll_id' => $this->poll_id));
if ($total == 0)
return 0;
$me = PollAnswerUser::model()->countByAttributes(array('poll_answer_id' => $this->id));
return $me / $total * 100;
}
/**
* Returns the total number of users voted for this answer
*
* @return int
*/
public function getTotal() {
return PollAnswerUser::model()->countByAttributes(array('poll_answer_id' => $this->id));
}
}

View File

@ -1,59 +0,0 @@
<?php
/**
* This is the model class for table "poll_answer_user".
*
* The followings are the available columns in table 'poll_answer_user':
* @property integer $id
* @property integer $question_id
* @property integer $question_answer_id
* @property string $created_at
* @property integer $created_by
* @property string $updated_at
* @property integer $updated_by
*
* @package humhub.modules.polls.models
* @since 0.5
* @author Luke
*/
class PollAnswerUser extends HActiveRecord {
/**
* Returns the static model of the specified AR class.
* @param string $className active record class name.
* @return QuestionAnswerUser the static model class
*/
public static function model($className = __CLASS__) {
return parent::model($className);
}
/**
* @return string the associated database table name
*/
public function tableName() {
return 'poll_answer_user';
}
/**
* @return array validation rules for model attributes.
*/
public function rules() {
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('poll_answer_id, poll_id, created_at, created_by, updated_at, updated_by', 'required'),
array('poll_answer_id, poll_id, created_by, updated_by', 'numerical', 'integerOnly' => true),
);
}
/**
* @return array relational rules.
*/
public function relations() {
return array(
'poll' => array(self::BELONGS_TO, 'poll', 'id'),
'user' => array(self::BELONGS_TO, 'User', 'created_by'),
);
}
}

View File

@ -1,10 +0,0 @@
{
"id": "polls",
"name": "Polls",
"description": "Simple polling system",
"keywords": ["poll", "voting"],
"version": "0.5",
"humhub": {
"minVersion": "0.5"
}
}

View File

@ -1,17 +0,0 @@
<?php
/**
* PollCreatedNotification is fired to the user who manually add to a poll for getting a notification.
*
* @author Andreas Strobel
*/
class PollCreatedNotification extends Notification {
// Path to Web View of this Notification
public $webView = "polls.views.notifications.PollCreated";
// Path to Mail Template for this notification
public $mailView = "application.modules.polls.views.notifications.PollCreated_mail";
}
?>

View File

@ -1,109 +0,0 @@
<?php
/**
* View to display a box with users and optional pagination.
*
* @property String $title is the title of the box.
* @property CPagination $pagination is the pagination object.
* @property Array $users is the arary of users to display.
*
* @package humhub.modules_core.user.views
* @since 0.5
*/
?>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title"
id="myModalLabel">
<?php echo Yii::t('LikeModule.base', 'User who vote this'); ?>
<?php echo $title;?>
</h4>
</div>
<div id="userlist-content">
<ul class="media-list">
<!-- BEGIN: Results -->
<?php foreach ($users as $user) : ?>
<?php
// Check for null user, if there are "zombies" in search index
if ($user == null)
continue;
?>
<li>
<a href="<?php echo $user->getUrl(); ?>">
<div class="media">
<img class="media-object img-rounded pull-left"
src="<?php echo $user->getProfileImage()->getUrl(); ?>" width="50"
height="50" alt="50x50" data-src="holder.js/50x50"
style="width: 50px; height: 50px;">
<div class="media-body">
<h4 class="media-heading"><?php echo $user->displayName; ?>
<?php if ($user->group != null) { ?>
<small>(<?php echo $user->group->name; ?>)</small><?php } ?>
</h4>
<h5><?php echo $user->title; ?></h5>
</div>
</div>
</a>
</li>
<?php endforeach; ?>
<!-- END: Results -->
</ul>
<div class="pagination-container">
<?php
$this->widget('HAjaxLinkPager', array(
'currentPage' => $pagination->getCurrentPage(),
'itemCount' => $pagination->getItemCount(),
'pageSize' => HSetting::Get('paginationSize'),
'maxButtonCount' => 5,
'ajaxContentTarget' => '.modal-dialog',
'nextPageLabel' => '<i class="fa fa-step-forward"></i>',
'prevPageLabel' => '<i class="fa fa-step-backward"></i>',
'firstPageLabel' => '<i class="fa fa-fast-backward"></i>',
'lastPageLabel' => '<i class="fa fa-fast-forward"></i>',
'header' => '',
'htmlOptions' => array('class' => 'pagination'),
));
?>
</div>
</div>
</div>
</div>
<script type="text/javascript">
/*
* Modal handling by close event
*/
$('#globalModal').on('hidden.bs.modal', function (e) {
// Reload whole page (to see changes on it)
//window.location.reload();
// just close modal and reset modal content to default (shows the loader)
$('#globalModal').html('<div class="modal-dialog"><div class="modal-content"><div class="modal-body"><div class="loader"></div></div></div></div>');
})
</script>
<script type="text/javascript">
// scroll to top of list
$(".modal-body").animate({ scrollTop: 0 }, 200);
</script>

View File

@ -1,6 +0,0 @@
<?php $this->beginContent('application.modules_core.activity.views.activityLayout', array('activity' => $activity)); ?>
<strong><?php echo $user->displayName; ?></strong>
<?php echo Yii::t('PollsModule.base', 'voted in question'); ?> "<i><?php echo Helpers::truncateText($target->question, 25); ?></i>".
<?php $this->endContent(); ?>

View File

@ -1,152 +0,0 @@
<!-- START NOTIFICATION/ACTIVITY -->
<tr>
<td align="center" valign="top" class="fix-box">
<!-- start container width 600px -->
<table width="600" align="center" border="0" cellspacing="0" cellpadding="0" class="container" bgcolor="#ffffff"
style="background-color: #ffffff; border-bottom-left-radius: 4px; border-bottom-left-radius: 4px;">
<tr>
<td valign="top">
<!-- start container width 560px -->
<table width="560" align="center" border="0" cellspacing="0" cellpadding="0" class="full-width"
bgcolor="#ffffff" style="background-color:#ffffff;">
<!-- start image and content -->
<tr>
<td valign="top" width="100%">
<!-- start content left -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="left">
<!--start space height -->
<tr>
<td height="20"></td>
</tr>
<!--end space height -->
<!-- start content top-->
<tr>
<td valign="top" align="left">
<table border="0" cellspacing="0" cellpadding="0" align="left">
<tr>
<td valign="top" align="left" style="padding-right:20px;">
<!-- START: USER IMAGE -->
<a href="<?php echo Yii::app()->createUrl('user/profile', array('guid' => $user->guid)); ?>">
<img
src="<?php echo $user->getProfileImage()->getUrl(); ?>"
width="69"
alt="face1_69x69"
style="max-width:69px; display:block !important; border-radius: 4px;"
border="0" hspace="0" vspace="0"/>
</a>
<!-- END: USER IMAGE -->
</td>
<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0"
align="left">
<tr>
<td style="font-size: 18px; line-height: 22px; font-family:Open Sans, Arial,Tahoma, Helvetica, sans-serif; color:#555555; font-weight:300; text-align:left;">
<span style="color: #555555; font-weight: 300;">
<a href="<?php echo Yii::app()->createUrl('user/profile', array('guid' => $user->guid)); ?>"
style="text-decoration: none; color: #555555; font-weight: 300;">
<!-- START: USER NAME -->
<?php echo $user->displayName; ?>
<!-- END: USER NAME -->
</a>
</span>
</td>
</tr>
<!--start space height -->
<tr>
<td height="10"></td>
</tr>
<!--end space height -->
<tr>
<td style="font-size: 13px; line-height: 22px; font-family:Open Sans,Arial,Tahoma, Helvetica, sans-serif; color:#a3a2a2; font-weight:300; text-align:left; ">
<!-- START: CONTENT -->
<?php echo Yii::t('PollsModule.base', 'answered question'); ?>
<br><?php echo Helpers::truncateText($target->question, 25); ?><?php if ($workspace != null && Wall::$currentType != Wall::TYPE_SPACE): ?> in
<strong><?php echo Helpers::truncateText($workspace->name, 25); ?></strong><?php endif; ?>
&nbsp;
<!-- END: CONTENT -->
<!-- START: CONTENT LINK -->
<span
style="text-decoration: none; color: #7191a8;"><a
href="<?php echo Yii::app()->createUrl('wall/perma/content', array('model' => 'Poll', 'id' => $target->id)); ?>"
style="text-decoration: none; color: #7191a8; "><strong><?php echo Yii::t('PollsModule.base', 'Go to poll'); ?></strong></a></span>
<!-- END: CONTENT LINK -->
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<!-- end content top-->
<!--start space height -->
<tr>
<td height="15" class="col-underline"></td>
</tr>
<!--end space height -->
</table>
<!-- end content left -->
</td>
</tr>
<!-- end image and content -->
</table>
<!-- end container width 560px -->
</td>
</tr>
</table>
<!-- end container width 600px -->
</td>
</tr>
<!-- END NOTIFICATION/ACTIVITY -->

View File

@ -1,7 +0,0 @@
<?php $this->beginContent('application.modules_core.activity.views.activityLayout', array('activity' => $activity)); ?>
<strong><?php echo $user->displayName; ?></strong>
<?php echo Yii::t('PollsModule.base', 'created a new poll'); ?> "<i><?php echo Helpers::truncateText($target->question, 25); ?></i>".
<?php $this->endContent(); ?>

View File

@ -1,162 +0,0 @@
<!-- START NOTIFICATION/ACTIVITY -->
<tr>
<td align="center" valign="top" class="fix-box">
<!-- start container width 600px -->
<table width="600" align="center" border="0" cellspacing="0" cellpadding="0" class="container" bgcolor="#ffffff"
style="background-color: #ffffff; border-bottom-left-radius: 4px; border-bottom-left-radius: 4px;">
<tr>
<td valign="top">
<!-- start container width 560px -->
<table width="560" align="center" border="0" cellspacing="0" cellpadding="0" class="full-width"
bgcolor="#ffffff" style="background-color:#ffffff;">
<!-- start image and content -->
<tr>
<td valign="top" width="100%">
<!-- start content left -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="left">
<!--start space height -->
<tr>
<td height="20"></td>
</tr>
<!--end space height -->
<!-- start content top-->
<tr>
<td valign="top" align="left">
<table border="0" cellspacing="0" cellpadding="0" align="left">
<tr>
<td valign="top" align="left" style="padding-right:20px;">
<!-- START: USER IMAGE -->
<a href="<?php echo Yii::app()->createUrl('user/profile', array('guid' => $user->guid)); ?>">
<img
src="<?php echo $user->getProfileImage()->getUrl(); ?>"
width="69"
alt="face1_69x69"
style="max-width:69px; display:block !important; border-radius: 4px;"
border="0" hspace="0" vspace="0"/>
</a>
<!-- END: USER IMAGE -->
</td>
<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0"
align="left">
<tr>
<td style="font-size: 18px; line-height: 22px; font-family:Open Sans, Arial,Tahoma, Helvetica, sans-serif; color:#555555; font-weight:300; text-align:left;">
<span style="color: #555555; font-weight: 300;">
<a href="<?php echo Yii::app()->createUrl('user/profile', array('guid' => $user->guid)); ?>"
style="text-decoration: none; color: #555555; font-weight: 300;">
<!-- START: USER NAME -->
<?php echo $user->displayName; ?>
<!-- END: USER NAME -->
</a>
</span>
</td>
</tr>
<!--start space height -->
<tr>
<td height="10"></td>
</tr>
<!--end space height -->
<tr>
<td style="font-size: 13px; line-height: 22px; font-family:Open Sans,Arial,Tahoma, Helvetica, sans-serif; color:#a3a2a2; font-weight:300; text-align:left; ">
<!-- START: CONTENT -->
<?php echo Yii::t('PollsModule.base', 'asked the question:'); ?>
<br><?php echo Helpers::truncateText($target->question, 25); ?><?php if ($workspace != null && Wall::$currentType != Wall::TYPE_SPACE): ?> in
<strong><?php echo Helpers::truncateText($workspace->name, 25); ?></strong><?php endif; ?>
&nbsp;
<!-- END: CONTENT -->
<!-- START: CONTENT LINK -->
<span
style="text-decoration: none; color: #7191a8;"><a
href="<?php echo Yii::app()->createUrl('wall/perma/content', array('model' => 'Poll', 'id' => $target->id)); ?>"
style="text-decoration: none; color: #7191a8; "><strong><?php echo Yii::t('PollsModule.base', 'Vote now'); ?></strong></a></span>
<!-- END: CONTENT LINK -->
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<!-- end content top-->
<!--start space height -->
<tr>
<td height="15" class="col-underline"></td>
</tr>
<!--end space height -->
</table>
<!-- end content left -->
</td>
</tr>
<!-- end image and content -->
</table>
<!-- end container width 560px -->
</td>
</tr>
</table>
<!-- end container width 600px -->
</td>
</tr>
<!-- END NOTIFICATION/ACTIVITY -->

View File

@ -1,11 +0,0 @@
<?php $this->beginContent('application.modules_core.notification.views.notificationLayout', array('notification' => $notification)); ?>
<strong><?php echo $creator->displayName; ?></strong>
<?php echo Yii::t('PollModule.base', 'created a new poll and assigned you.'); ?>
<?php $this->endContent(); ?>

View File

@ -1,144 +0,0 @@
<!-- START NOTIFICATION/ACTIVITY -->
<tr>
<td align="center" valign="top" class="fix-box">
<!-- start container width 600px -->
<table width="600" align="center" border="0" cellspacing="0" cellpadding="0" class="container" bgcolor="#ffffff"
style="background-color: #ffffff; border-bottom-left-radius: 4px; border-bottom-left-radius: 4px;">
<tr>
<td valign="top">
<!-- start container width 560px -->
<table width="560" align="center" border="0" cellspacing="0" cellpadding="0" class="full-width"
bgcolor="#ffffff" style="background-color:#ffffff;">
<!-- start image and content -->
<tr>
<td valign="top" width="100%">
<!-- start content left -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="left">
<!--start space height -->
<tr>
<td height="20"></td>
</tr>
<!--end space height -->
<!-- start content top-->
<tr>
<td valign="top" align="left">
<table border="0" cellspacing="0" cellpadding="0" align="left">
<tr>
<td valign="top" align="left" style="padding-right:20px;">
<!-- START: USER IMAGE -->
<a href="<?php echo Yii::app()->createUrl('user/profile', array('guid' => $creator->guid)); ?>">
<img
src="<?php echo $creator->getProfileImage()->getUrl(); ?>"
width="69"
alt="face1_69x69"
style="max-width:69px; display:block !important; border-radius: 4px;"
border="0" hspace="0" vspace="0"/>
</a>
<!-- END: USER IMAGE -->
</td>
<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0"
align="left">
<tr>
<td style="font-size: 18px; line-height: 22px; font-family:Open Sans, Arial,Tahoma, Helvetica, sans-serif; color:#555555; font-weight:300; text-align:left;">
<span style="color: #555555; font-weight: 300;">
<a href="<?php echo Yii::app()->createUrl('user/profile', array('guid' => $creator->guid)); ?>"
style="text-decoration: none; color: #555555; font-weight: 300;">
<!-- START: USER NAME -->
<?php echo $creator->displayName; ?>
<!-- END: USER NAME -->
</a>
</span>
</td>
</tr>
<!--start space height -->
<tr>
<td height="10"></td>
</tr>
<!--end space height -->
<tr>
<td style="font-size: 13px; line-height: 22px; font-family:Open Sans,Arial,Tahoma, Helvetica, sans-serif; color:#a3a2a2; font-weight:300; text-align:left; ">
<!-- START: CONTENT -->
<?php echo Yii::t('PollModule.base', 'created a new poll and assigned you.'); ?> <?php if ($workspace != null && Wall::$currentType != Wall::TYPE_SPACE): ?> in <strong><?php echo Helpers::truncateText($workspace->name, 25); ?></strong><?php endif; ?>
&nbsp;
<!-- END: CONTENT -->
<!-- START: CONTENT LINK -->
<span
style="text-decoration: none; color: #7191a8;"><a
href="<?php echo $notification->getUrl(); ?>"
style="text-decoration: none; color: #7191a8; "><strong><?php echo Yii::t('PostModule.base', 'go to poll'); ?></strong></a></span>
<!-- END: CONTENT LINK -->
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<!-- end content top-->
<!--start space height -->
<tr>
<td height="15" class="col-underline"></td>
</tr>
<!--end space height -->
</table>
<!-- end content left -->
</td>
</tr>
<!-- end image and content -->
</table>
<!-- end container width 560px -->
</td>
</tr>
</table>
<!-- end container width 600px -->
</td>
</tr>
<!-- END NOTIFICATION/ACTIVITY -->

View File

@ -1,15 +0,0 @@
<?php
/**
* This view is shown when a user clicks on the "Polls" Navigation Items in the
* Space Navigation.
*
* Its shows an FormWidget to create a new poll and a stream widget which shows
* all existing polls.
*
* @package humhub.modules.polls.views
* @since 0.5
*/
?>
<?php $this->widget('application.modules.polls.widgets.PollFormWidget', array('contentContainer' => $this->getSpace())); ?>
<?php $this->widget('application.modules.polls.widgets.PollsStreamWidget', array('contentContainer' => $this->getSpace())); ?>

View File

@ -1,22 +0,0 @@
<?php
/**
* PollFormWidget handles the form to create new polls.
*
* @package humhub.modules.polls.widgets
* @since 0.5
* @author Luke
*/
class PollFormWidget extends ContentFormWidget {
public function renderForm() {
$this->submitUrl = 'polls/poll/create';
$this->submitButtonText = Yii::t('PollsModule.base', 'Ask');
$this->form = $this->render('pollForm', array(), true);
}
}
?>

View File

@ -1,25 +0,0 @@
<?php
/**
* PollWallEntryWidget is used to display a poll inside the stream.
*
* This Widget will used by the Poll Model in Method getWallOut().
*
* @package humhub.modules.polls.widgets
* @since 0.5
* @author Luke
*/
class PollWallEntryWidget extends HWidget {
public $poll;
public function run() {
$this->render('entry', array('poll' => $this->poll,
'user' => $this->poll->content->user,
'space' => $this->poll->content->container));
}
}
?>

View File

@ -1,16 +0,0 @@
<?php
/**
* PollsStreamWidget is used show a stream of poll objects only.
*
* @package humhub.modules.polls.widgets
* @since 0.5
* @author Luke
*/
class PollsStreamWidget extends WallStreamWidget {
public $streamAction = "//polls/poll/stream";
}
?>

View File

@ -1,143 +0,0 @@
<?php
/**
* This view represents a wall entry of a polls.
* Used by PollWallEntryWidget to show Poll inside a wall.
*
* @property User $user the user which created this poll
* @property Poll $poll the current poll
* @property Space $space the current space
*
* @package humhub.modules.polls.widgets.views
* @since 0.5
*/
?>
<div class="panel panel-default">
<div class="panel-body">
<?php $this->beginContent('application.modules_core.wall.views.wallLayout', array('object' => $poll)); ?>
<?php echo CHtml::beginForm(); ?>
<?php print nl2br($poll->question); ?><br><br>
<!-- Loop and Show Answers -->
<?php foreach ($poll->answers as $answer): ?>
<div class="row">
<?php if (!$poll->hasUserVoted()) : ?>
<div class="col-md-1" style="padding-right: 0;">
<?php if ($poll->allow_multiple) : ?>
<div class="checkbox">
<label>
<?php echo CHtml::checkBox('answers[' . $answer->id . ']'); ?>
</label>
</div>
<?php else: ?>
<div class="radio">
<label>
<?php echo CHtml::radioButton('answers', false, array('value' => $answer->id, 'id' => 'answer_'. $answer->id)); ?>
</label>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php
$percent = round($answer->getPercent());
$color = "progress-bar-info";
?>
<div class="col-md-6">
<b><?php echo $answer->answer; ?></b><br>
<div class="progress">
<div id="progress_<?php echo $answer->id; ?>" class="progress-bar <?php echo $color; ?>" role="progressbar" aria-valuenow="<?php echo $percent; ?>" aria-valuemin="0" aria-valuemax="100" style="width: 0%"></div>
</div>
<script type="text/javascript">
$('#progress_<?php echo $answer->id; ?>').css('width', '<?php echo $percent; ?>%');
</script>
</div>
<div class="col-md-4">
<?php
$userlist = ""; // variable for users output
$maxUser = 10; // limit for rendered users inside the tooltip
for ($i = 0; $i < count($answer->votes); $i++) {
// if only one user likes
// check if exists more user as limited
if ($i == $maxUser) {
// output with the number of not rendered users
$userlist .= Yii::t('PollsModule.base', 'and {count} more vote for this.', array('{count}' => (intval(count($answer->votes) - $maxUser))));
// stop the loop
break;
} else {
$userlist .= "<strong>" . $answer->votes[$i]->user->displayName . "</strong><br>";
}
}
?>
<p style="margin-top: 14px;">
<?php if (count($answer->votes) > 0) { ?>
<a href="<?php echo $this->createUrl('//polls/poll/userListResults', array('pollId' => $poll->id, 'answerId' => $answer->id)); ?>"
class="tt" data-toggle="modal"
data-placement="top" title="" data-target="#globalModal"
data-original-title="<?php echo $userlist; ?>"><?php echo count($answer->votes) . " " . Yii::t('PollsModule.base', 'votes'); ?></a>
<?php } else { ?>
0 <?php echo Yii::t('PollsModule.base', 'votes'); ?>
<?php } ?>
</p>
</div>
</div>
<div class="clearFloats"></div>
<?php endforeach; ?>
<?php if (!$poll->hasUserVoted()) : ?>
<br>
<?php
$voteUrl = CHtml::normalizeUrl(array('/polls/poll/answer', 'sguid' => $space->guid, 'pollId' => $poll->id, 'wallType'=>Wall::$currentType));
echo HHtml::ajaxSubmitButton(Yii::t('PollsModule.base', 'Vote'), $voteUrl, array(
'dataType' => 'json',
'success' => "function(json) { $('#wallEntry_'+json.wallEntryId).html(parseHtml(json.output)); }",
), array('id' => "PollAnswerButton_" . $poll->id, 'class' => 'btn btn-primary')
);
?>
<br>
<?php endif; ?>
<div class="clearFloats"></div>
<?php echo CHtml::endForm(); ?>
<?php if ($poll->hasUserVoted()) : ?>
<br>
<?php
$voteUrl = CHtml::normalizeUrl(array('/polls/poll/answerReset', 'sguid' => $space->guid, 'pollId' => $poll->id, 'wallType' => Wall::$currentType));
echo HHtml::ajaxLink(Yii::t('PollsModule.base', 'Reset my vote'), $voteUrl, array(
'dataType' => 'json',
'success' => "function(json) { $('#wallEntry_'+json.wallEntryId).html(parseHtml(json.output)); $('#wallEntry_'+json.wallEntryId).find(':checkbox, :radio').flatelements(); }",
), array('id' => "PollAnswerResetButton_" . $poll->id, 'class' => 'btn btn-danger')
);
?>
<br>
<?php endif; ?>
<?php $this->endContent(); ?>
</div>
</div>

View File

@ -1,11 +0,0 @@
<?php echo CHtml::textArea("question", "", array('id'=>'contentForm_question', 'class' => 'form-control autosize contentForm', 'rows' => '1', "tabindex" => "1", "placeholder" => Yii::t('PollsModule.base', "Ask something..."))); ?>
<div class="contentForm_options">
<?php echo CHtml::textArea("answersText", "", array('id' => "contentForm_answersText", 'rows' => '5', 'style' => 'height: auto !important;', "class" => "form-control contentForm", "tabindex" => "2", "placeholder" => Yii::t('PollsModule.base', "Possible answers (one per line)"))); ?>
<div class="checkbox">
<label>
<?php echo CHtml::checkbox("allowMultiple", "", array('id' => "contentForm_allowMultiple", 'class' => 'checkbox contentForm', "tabindex" => "4")); ?> <?php echo Yii::t('PollsModule.base', 'Allow multiple answers per user?'); ?>
</label>
</div>
</div>

View File

@ -1,77 +0,0 @@
<?php
/**
* This view shows the stream of all available polls.
* Used by PollStreamWidget.
*
* @property Space $space the current space
*
* @package humhub.modules.polls.widgets.views
* @since 0.5
*/
?>
<ul class="nav nav-tabs wallFilterPanel" id="filter" style="display: none;">
<li class=" dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#"><?php echo Yii::t('WallModule.base', 'Filter'); ?> <b class="caret"></b></a>
<ul class="dropdown-menu">
<!--<li><a href="#" class="wallFilter" id="filter_visibility_public"><i class="fa fa-check-square-o"></i> <?php echo Yii::t('PollsModule.base', 'Display all'); ?></a></li>-->
<li><a href="#" class="wallFilter" id="filter_polls_notAnswered"><i class="fa fa-square-o"></i> <?php echo Yii::t('PollsModule.base', 'No answered yet'); ?></a></li>
<li><a href="#" class="wallFilter" id="filter_entry_mine"><i class="fa fa-square-o"></i> <?php echo Yii::t('PollsModule.base', 'Asked by me'); ?></a></li>
<li><a href="#" class="wallFilter" id="filter_visibility_public"><i class="fa fa-square-o"></i> <?php echo Yii::t('PollsModule.base', 'Only public polls'); ?></a></li>
<li><a href="#" class="wallFilter" id="filter_visibility_private"><i class="fa fa-square-o"></i> <?php echo Yii::t('PollsModule.base', 'Only private polls'); ?></a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#"><?php echo Yii::t('WallModule.base', 'Sorting'); ?> <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#" class="wallSorting" id="sorting_c"><i class="fa fa-check-square-o"></i> <?php echo Yii::t('WallModule.base', 'Creation time'); ?></a></li>
<li><a href="#" class="wallSorting" id="sorting_u"><i class="fa fa-square-o"></i> <?php echo Yii::t('WallModule.base', 'Last update'); ?></a></li>
</ul>
</li>
</ul>
<div id="pollStream">
<!-- DIV for an normal wall stream -->
<div class="s2_stream" style="display:none">
<div class="s2_streamContent"></div>
<div class="loader streamLoader"></div>
<div class="emptyStreamMessage">
<?php if ($this->contentContainer->canWrite()) { ?>
<div class="placeholder placeholder-empty-stream">
<?php echo Yii::t('PollModule.base', '<b>There are no polls yet!</b><br>Be the first and create one...'); ?>
</div>
<?php }?>
</div>
<div class="emptyFilterStreamMessage">
<div class="placeholder">
<b><?php echo Yii::t('PollsModule.base', 'No poll found which matches your current filter(s)!'); ?></b>
</div>
</div>
</div>
<!-- DIV for an single wall entry -->
<div class="s2_single" style="display: none;">
<div class="back_button_holder">
<a href="#" class="singleBackLink button_white"><?php echo Yii::t('WallModule.base', 'Back to stream'); ?></a>
</div>
<div class="p_border"></div>
<div class="s2_singleContent"></div>
<div class="loader streamLoaderSingle"></div>
</div>
</div>
<script>
// Kill current stream
if (currentStream) {
currentStream.clear();
}
s = new Stream("#pollStream", "<?php echo $startUrl; ?>", "<?php echo $reloadUrl; ?>", "<?php echo $singleEntryUrl; ?>");
s.showStream();
currentStream = s;
</script>