예제 #1
0
파일: issue.php 프로젝트: Ricardolau/imc
 /**
  * Method to get an ojbect.
  *
  * @param	integer	The id of the object to get.
  *
  * @return	mixed	Object on success, false on failure.
  */
 public function &getData($id = null)
 {
     if ($this->_item === null) {
         $this->_item = false;
         if (empty($id)) {
             $id = $this->getState('issue.id');
         }
         // Get a level row instance.
         $table = $this->getTable();
         // Attempt to load the row.
         if ($table->load($id)) {
             // Check published state.
             if ($published = $this->getState('filter.published')) {
                 if ($table->state != $published) {
                     return $this->_item;
                 }
             }
             // Convert the JTable to a clean JObject.
             $properties = $table->getProperties(1);
             $this->_item = JArrayHelper::toObject($properties, 'JObject');
         } elseif ($error = $table->getError()) {
             $this->setError($error);
         }
     }
     if (is_object($this->_item)) {
         $step = ImcFrontendHelper::getStepByStepId($this->_item->stepid);
         if ($step) {
             $this->_item->stepid_title = $step['stepid_title'];
             $this->_item->stepid_color = $step['stepid_color'];
         }
         if (isset($this->_item->created_by)) {
             $this->_item->created_by_name = JFactory::getUser($this->_item->created_by)->name;
         }
         $category = JCategories::getInstance('Imc')->get($this->_item->catid);
         if ($category) {
             $prms = json_decode($category->params);
             // if(isset($prms->imc_category_emails))
             //     $this->_item->notification_emails = explode("\n", $prms->imc_category_emails);
             // else
             //     $this->_item->notification_emails = array();
             if (isset($prms->image)) {
                 $this->_item->category_image = $prms->image;
             } else {
                 $this->_item->category_image = '';
             }
             $this->_item->catid_title = $category->title;
         } else {
             $this->_item->category_image = '';
             $this->_item->catid_title = 'CATEGORY IS NO LONGER PUBLISHED';
         }
     }
     return $this->_item;
 }
예제 #2
0
파일: edit_print.php 프로젝트: viru48/imc
		<p><strong><?php 
echo JText::_('COM_IMC_FORM_LBL_ISSUE_ID');
?>
</strong>: 
		<?php 
echo $this->item->id;
?>
		</p>
		
		<p><strong><?php 
echo JText::_('COM_IMC_FORM_LBL_ISSUE_STEPID');
?>
</strong>: 
		<?php 
$step = ImcFrontendHelper::getStepByStepId($this->item->stepid);
?>
		<span style="color: <?php 
echo $step['stepid_color'];
?>
"><?php 
echo $step['stepid_title'];
?>
</span>
		</p>

		<p><strong><?php 
echo JText::_('COM_IMC_FORM_LBL_ISSUE_CATID');
?>
</strong>: 
		<?php 
예제 #3
0
 public function onAfterStepModified($model, $validData, $id = null)
 {
     $details = $this->getDetails($id, $model);
     $app = JFactory::getApplication();
     $showMsgsFrontend = $this->params->get('messagesfrontend') && !$app->isAdmin();
     $showMsgsBackend = $this->params->get('messagesbackend') && $app->isAdmin();
     $step = ImcFrontendHelper::getStepByStepId($validData['stepid']);
     $MENUALIAS = $this->params->get('menualias');
     $appSite = JApplication::getInstance('site');
     $router = $appSite->getRouter();
     $uri = $router->build('index.php?option=com_imc&view=issue&id=' . (int) ($id == null ? $validData['id'] : $id));
     $parsed_url = $uri->toString();
     $parsed_url = str_replace('administrator/', '', $parsed_url);
     $parsed_url = str_replace('component/imc', $MENUALIAS, $parsed_url);
     $issueLink = $_SERVER['HTTP_HOST'] . $parsed_url;
     //Prepare email for admins
     if ($this->params->get('mailstatuschangeadmins')) {
         $subject = sprintf(JText::_('PLG_IMC_MAIL_NOTIFIER_ADMINS_STEP_MODIFIED_SUBJECT'), $id == null ? $validData['id'] : $id);
         $body = sprintf(JText::_('PLG_IMC_MAIL_NOTIFIER_ADMINS_STEP_MODIFIED_BODY'), $validData['title'], $step['stepid_title'], JFactory::getUser()->name);
         if (empty($details->emails) || $details->emails[0] == '') {
             if ($showMsgsBackend) {
                 $app->enqueueMessage(JText::_('PLG_IMC_MAIL_NOTIFIER_ADMINS_MAIL_NOT_SET') . ImcFrontendHelper::getCategoryNameByCategoryId($validData['catid']), 'warning');
             }
         } else {
             $recipients = implode(',', $details->emails);
             if ($this->sendMail($subject, $body, $details->emails)) {
                 if ($showMsgsBackend) {
                     $app->enqueueMessage(JText::_('PLG_IMC_MAIL_NOTIFIER_ADMINS_MAIL_CONFIRM') . $recipients);
                 }
             } else {
                 if ($showMsgsBackend) {
                     $app->enqueueMessage(JText::_('PLG_IMC_MAIL_NOTIFIER_MAIL_FAILED') . $recipients, 'error');
                 }
             }
         }
     }
     //Prepare email for user
     if ($this->params->get('mailstatuschangeuser')) {
         $subject = sprintf(JText::_('PLG_IMC_MAIL_NOTIFIER_USER_STEP_MODIFIED_SUBJECT'), $id == null ? $validData['id'] : $id);
         $body = sprintf(JText::_('PLG_IMC_MAIL_NOTIFIER_USER_STEP_MODIFIED_BODY'), $validData['title'], $step['stepid_title'], $issueLink);
         $body .= '<a href="http://' . $issueLink . '">' . $issueLink . '</a>';
         if ($this->sendMail($subject, $body, $details->usermail)) {
             if ($showMsgsBackend) {
                 $app->enqueueMessage(JText::_('PLG_IMC_MAIL_NOTIFIER_MAIL_STEP_MODIFIED_CONFIRM') . $details->usermail . ' (' . $details->username . ')');
             }
             if ($showMsgsFrontend) {
                 $app->enqueueMessage(JText::_('PLG_IMC_MAIL_NOTIFIER_MAIL_STEP_MODIFIED_CONFIRM') . $details->usermail . ' (' . $details->username . ')');
             }
         } else {
             $app->enqueueMessage(JText::_('PLG_IMC_MAIL_NOTIFIER_MAIL_FAILED') . $recipients, 'error');
         }
     }
 }
예제 #4
0
파일: default.php 프로젝트: Ricardolau/imc
<div id="columns">
    <div class="row masonry" id="masonry-sample">
        <?php 
foreach ($this->items as $i => $item) {
    ?>
            <?php 
    $canCreate = $user->authorise('core.create', 'com_imc.issue.' . $item->id);
    $canEdit = $user->authorise('core.edit', 'com_imc.issue.' . $item->id);
    $canCheckin = $user->authorise('core.manage', 'com_imc.issue.' . $item->id);
    $canChange = $user->authorise('core.edit.state', 'com_imc.issue.' . $item->id);
    $canDelete = $user->authorise('core.delete', 'com_imc.issue.' . $item->id);
    //$canEditOwn = $user->authorise('core.edit.own', 'com_imc.issue.' . $item->id);
    $attachments = json_decode($item->photo);
    //Edit Own only if issue status is the initial one
    $firstStep = ImcFrontendHelper::getStepByStepId($item->stepid);
    $canEditOnStatus = true;
    if ($firstStep['ordering'] != 1) {
        $canEditOnStatus = false;
    }
    ?>
            <?php 
    if (!$canEdit && $user->authorise('core.edit.own', 'com_imc.issue.' . $item->id)) {
        ?>
                <?php 
        $canEdit = JFactory::getUser()->id == $item->created_by;
        ?>
            <?php 
    }
    ?>