コード例 #1
0
ファイル: search.php プロジェクト: IuriiP/yii-tracker
?>
</legend>
                    <p id="ticket-status" class='inline-input'>
                    	<?php 
echo CHtml::activeLabel($search, 'status');
?>
                    	<?php 
echo CHtml::activeListBox($search, 'status', CHtml::listData(TicketStatus::model()->findAll(), 'id', 'title'), array('multiple' => 'multiple'));
?>
                    </p>
                    <p id="ticket-priority" class='inline-input'>
                    	<?php 
echo CHtml::activeLabel($search, 'priority');
?>
                    	<?php 
echo CHtml::activeListBox($search, 'priority', CHtml::listData(TicketPriority::model()->findAll(), 'id', 'title'), array('multiple' => 'multiple'));
?>
                    </p>
                    <p id="ticket-type" class='inline-input'>
                    	<?php 
echo CHtml::activeLabel($search, 'type');
?>
                    	<?php 
echo CHtml::activeListBox($search, 'type', CHtml::listData(TicketType::model()->findAll(), 'id', 'title'), array('multiple' => 'multiple'));
?>
                    </p>
                    <p id="ticket-category" class='inline-input'>
                    	<?php 
echo CHtml::activeLabel($search, 'category');
?>
                    	<?php 
コード例 #2
0
ファイル: TicketProps.php プロジェクト: evan70/yii-tracker
 /**
  * table data rules
  *
  * @return array
  */
 public function rules()
 {
     return array(array('status', 'in', 'range' => CHtml::listData(TicketStatus::model()->findAll(), 'id', 'id')), array('type', 'in', 'range' => CHtml::listData(TicketType::model()->findAll(), 'id', 'id')), array('category', 'in', 'range' => CHtml::listData(TicketCategory::model()->findAll(), 'id', 'id')), array('priority', 'in', 'range' => CHtml::listData(TicketPriority::model()->findAll(), 'id', 'id')), array('version', 'in', 'range' => CHtml::listData(TicketVersion::model()->findAll(), 'id', 'id')), array('fixedin', 'in', 'range' => CHtml::listData(TicketVersion::model()->findAll(), 'id', 'id')), array('assignedtoid', 'safe'), array('keywords', 'safe'), array('title', 'required'), array('title', 'length', 'min' => 3, 'max' => 100));
 }
コード例 #3
0
 /**
  * View single ticket
  * 
  * @param int $id
  * @param string $alias
  */
 public function actionViewTicket($id, $alias)
 {
     if ($id && ($ticket = Tickets::model()->with(array('reporter', 'assigned', 'status', 'type', 'category', 'ticketpriority', 'version', 'fixed', 'ticketmilestone', 'comments', 'comments.commentreporter', 'comments.changes', 'lastcomment'))->byCommentDate()->findByPk($id))) {
         // Initiate the ticket comment model
         $comment = new TicketComments();
         $props = new TicketProps();
         $ticketChanges = array();
         $commentPassed = false;
         $propsPassed = false;
         $propertiesPassed = false;
         // Make sure if we submit the form that we enter a comment
         if (isset($_POST['TicketComments'])) {
             $comment->setAttributes($_POST['TicketComments']);
             $comment->ticketid = $ticket->id;
             if ($comment->validate()) {
                 $commentPassed = true;
             }
         }
         // Make suer we submitted the form
         if (isset($_POST['TicketProps'])) {
             $props->setAttributes($_POST['TicketProps']);
             if ($props->validate()) {
                 $propsPassed = true;
                 // did we change the title
                 if ($props->title != $ticket->title) {
                     $ticketChanges[] = Yii::t('tickets', '<strong>Title</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $ticket->title, '{new}' => $props->title));
                 }
                 // did we change the keywords
                 if ($props->keywords != $ticket->keywords) {
                     $ticketChanges[] = Yii::t('tickets', '<strong>Keywords</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $ticket->keywords, '{new}' => $props->keywords));
                 }
                 // did we change the assigned to
                 if ($props->assignedtoid && $props->assignedtoid != $ticket->assignedtoid) {
                     // Load the users
                     $oldUser = Users::model()->findByPk($ticket->assignedtoid);
                     $newUser = Users::model()->find('username=:username', array(':username' => $props->assignedtoid));
                     $ticketChanges[] = Yii::t('tickets', '<strong>Assigned</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $oldUser ? $oldUser->getLink() : "''", '{new}' => $newUser ? $newUser->getLink() : "''"));
                 }
                 // Did we change the status
                 if ($props->status && $props->status != $ticket->ticketstatus) {
                     $oldStatus = TicketStatus::model()->findByPk($ticket->ticketstatus);
                     $newStatus = TicketStatus::model()->findByPk($props->status);
                     $ticketChanges[] = Yii::t('tickets', '<strong>Status</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $oldStatus ? $oldStatus->getLink() : "''", '{new}' => $newStatus ? $newStatus->getLink() : "''"));
                     $ticket->ticketstatus = $props->status;
                 }
                 // Did we change the type
                 if ($props->type && $props->type != $ticket->tickettype) {
                     $oldType = TicketType::model()->findByPk($ticket->tickettype);
                     $newType = TicketType::model()->findByPk($props->type);
                     $ticketChanges[] = Yii::t('tickets', '<strong>Type</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $oldType ? $oldType->getLink() : "''", '{new}' => $newType ? $newType->getLink() : "''"));
                     $ticket->tickettype = $props->type;
                 }
                 // Did we change the category
                 if ($props->category && $props->category != $ticket->ticketcategory) {
                     $oldCategory = TicketCategory::model()->findByPk($ticket->ticketcategory);
                     $newCategory = TicketCategory::model()->findByPk($props->category);
                     $ticketChanges[] = Yii::t('tickets', '<strong>Category</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $oldCategory ? $oldCategory->getLink() : "''", '{new}' => $newCategory ? $newCategory->getLink() : "''"));
                     $ticket->ticketcategory = $props->category;
                 }
                 // Did we change the version
                 if ($props->version && $props->version != $ticket->ticketversion) {
                     $oldVersion = TicketVersion::model()->findByPk($ticket->ticketversion);
                     $newVersion = TicketVersion::model()->findByPk($props->version);
                     $ticketChanges[] = Yii::t('tickets', '<strong>Version</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $oldVersion ? $oldVersion->getVersionLink() : "''", '{new}' => $newVersion ? $newVersion->getVersionLink() : "''"));
                     $ticket->ticketversion = $props->version;
                 }
                 // Did we change the fixedin
                 if ($props->fixedin && $props->fixedin != $ticket->fixedin) {
                     $oldFixed = TicketVersion::model()->findByPk($ticket->fixedin);
                     $newFixed = TicketVersion::model()->findByPk($props->fixedin);
                     $ticketChanges[] = Yii::t('tickets', '<strong>Fixed In Version</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $oldFixed ? $oldFixed->getFixedinLink() : "''", '{new}' => $newFixed ? $newFixed->getFixedinLink() : "''"));
                     $ticket->fixedin = $props->fixedin;
                 }
                 // Did we change the priority
                 if ($props->priority && $props->priority != $ticket->priority) {
                     $oldPriority = TicketPriority::model()->findByPk($ticket->priority);
                     $newPriority = TicketPriority::model()->findByPk($props->priority);
                     $ticketChanges[] = Yii::t('tickets', '<strong>Priority</strong> Changed from <em>{old}</em> To <em>{new}</em>', array('{old}' => $oldPriority ? $oldPriority->getLink() : "''", '{new}' => $newPriority ? $newPriority->getLink() : "''"));
                     $ticket->priority = $props->priority;
                 }
                 // Assign props data to ticket
                 $ticket->title = $props->title;
                 $ticket->keywords = $props->keywords;
                 // Reset the ticket assigned to
                 if ($props->assignedtoid) {
                     $ticket->assignedtoid = $props->assignedtoid;
                 } else {
                     $ticket->assignedtoid = (int) $ticket->assignedtoid;
                 }
                 // Make sure we have some changes or at least entered comment
                 if (!$comment->content && !count($ticketChanges)) {
                     $commentPassed = false;
                     Functions::setFlash(Yii::t('tickets', 'You must enter a comment or make some changes to the ticket.'));
                 }
                 // validate ticket
                 if ($ticket->validate()) {
                     $propertiesPassed = true;
                 }
             }
         }
         // Only if all flags were ok then save and update
         if (isset($_POST['submit']) && $commentPassed && $propsPassed && $propertiesPassed) {
             // Save both and redirect
             $comment->save();
             // Did we change something?
             if (count($ticketChanges)) {
                 foreach ($ticketChanges as $change) {
                     $changes = new TicketChanges();
                     $changes->ticketid = $ticket->id;
                     $changes->commentid = $comment->id;
                     $changes->content = $change;
                     $changes->save();
                 }
             }
             // Save ticket
             $ticket->lastcommentid = $comment->id;
             $ticket->update();
             // Set flash
             Functions::setFlash(Yii::t('tickets', 'Tickets: Ticket Updated'));
             $this->redirect($ticket->getLink('', array(), true));
         }
         // Reset the ticket assigned to
         if ($props->assignedtoid) {
             if (is_int($props->assignedtoid)) {
                 $username = Users::model()->findByPk($props->assignedtoid);
             } else {
                 $username = Users::model()->find('username=:username', array(':username' => $props->assignedtoid));
             }
             $props->assignedtoid = $username ? $username->username : '';
         } else {
             $props->assignedtoid = '';
         }
         // Assign keywords
         if (!$props->keywords && $ticket->keywords) {
             $props->keywords = $ticket->keywords;
         }
         // Assign Title
         if (!$props->title && $ticket->title) {
             $props->title = $ticket->title;
         }
         // Show the view screen
         $this->pageTitle[] = Yii::t('tickets', 'Viewing Ticket - {title}', array('{title}' => CHtml::encode($ticket->title)));
         $this->render('showticket', array('props' => $props, 'ticket' => $ticket, 'comment' => $comment));
     } else {
         $this->redirect(array('/tickets'));
     }
 }
コード例 #4
0
?>
</legend>
                        <p id="ticket-status" class='inline-input'>
                        	<?php 
echo CHtml::activeLabel($moderation, 'status');
?>
                        	<?php 
echo CHtml::activeDropDownList($moderation, 'status', CHtml::listData(TicketStatus::model()->findAll(), 'id', 'title'), array('prompt' => Yii::t('tickets', '-- Select Status --')));
?>
                        </p>
                        <p id="ticket-priority" class='inline-input'>
                        	<?php 
echo CHtml::activeLabel($moderation, 'priority');
?>
                        	<?php 
echo CHtml::activeDropDownList($moderation, 'priority', CHtml::listData(TicketPriority::model()->findAll(), 'id', 'title'), array('prompt' => Yii::t('tickets', '-- Select Priority --')));
?>
                        </p>
                        <p id="ticket-type" class='inline-input'>
                        	<?php 
echo CHtml::activeLabel($moderation, 'type');
?>
                        	<?php 
echo CHtml::activeDropDownList($moderation, 'type', CHtml::listData(TicketType::model()->findAll(), 'id', 'title'), array('prompt' => Yii::t('tickets', '-- Select Type --')));
?>
                        </p>
                        <p id="ticket-category" class='inline-input'>
                        	<?php 
echo CHtml::activeLabel($moderation, 'category');
?>
                        	<?php 
コード例 #5
0
ファイル: Tickets.php プロジェクト: IuriiP/yii-tracker
 /**
  * table data rules
  *
  * @return array
  */
 public function rules()
 {
     return array(array('title, content', 'required'), array('title', 'length', 'min' => 3, 'max' => 100), array('keywords', 'length', 'max' => 100), array('content', 'length', 'min' => 3), array('projectid', 'in', 'range' => array_keys(Projects::model()->getUserProjects(true)), 'allowEmpty' => false, 'on' => 'ticketupdate'), array('ticketstatus', 'in', 'range' => CHtml::listData(TicketStatus::model()->findAll(), 'id', 'id')), array('tickettype', 'in', 'range' => CHtml::listData(TicketType::model()->findAll(), 'id', 'id')), array('ticketcategory', 'in', 'range' => CHtml::listData(TicketCategory::model()->findAll(), 'id', 'id')), array('priority', 'in', 'range' => CHtml::listData(TicketPriority::model()->findAll(), 'id', 'id')), array('ticketversion', 'in', 'range' => CHtml::listData(TicketVersion::model()->findAll(), 'id', 'id')), array('fixedin', 'in', 'range' => CHtml::listData(TicketVersion::model()->findAll(), 'id', 'id')), array('assignedtoid', 'checkAssignedTo'));
 }
コード例 #6
0
 /**
  * table data rules
  *
  * @return array
  */
 public function rules()
 {
     return array(array('status', 'in', 'range' => CHtml::listData(TicketStatus::model()->findAll(), 'id', 'id')), array('type', 'in', 'range' => CHtml::listData(TicketType::model()->findAll(), 'id', 'id')), array('category', 'in', 'range' => CHtml::listData(TicketCategory::model()->findAll(), 'id', 'id')), array('priority', 'in', 'range' => CHtml::listData(TicketPriority::model()->findAll(), 'id', 'id')), array('version', 'in', 'range' => CHtml::listData(TicketVersion::model()->findAll(), 'id', 'id')), array('fixedin', 'in', 'range' => CHtml::listData(TicketVersion::model()->findAll(), 'id', 'id')), array('assignedtoid', 'checkAssignedTo'));
 }
コード例 #7
0
ファイル: main.php プロジェクト: IuriiP/yii-tracker
        echo $status->getLink(CHtml::encode($status->title) . ' <small>(' . Yii::app()->format->number($status->ticketsCount) . ')</small>');
        ?>
                                </li>
                                <?php 
    }
    ?>
							</ul> 
		              </li>
		              <li class="widget-container">
                        <h3><?php 
    echo Yii::t('global', 'Priorities');
    ?>
</h3>			
                            <ul>
                                <?php 
    foreach (TicketPriority::model()->with(array('ticketsCount'))->findAll() as $priority) {
        ?>
    							<li>
                                    <?php 
        echo $priority->getRssLink(CHtml::image(Yii::app()->themeManager->baseUrl . '/images/atom.gif', 'ATOM'), array('class' => 'atom'), 'atom');
        ?>
                                    <?php 
        echo $priority->getRssLink(CHtml::image(Yii::app()->themeManager->baseUrl . '/images/rss.gif', 'RSS'), array('class' => 'rss'));
        ?>
                                    <?php 
        echo $priority->getLink(CHtml::encode($priority->title) . ' <small>(' . Yii::app()->format->number($priority->ticketsCount) . ')</small>');
        ?>
                                </li>
                                <?php 
    }
    ?>