public static function renderModelInput(CModel $model, $field, $htmlOptions = array()) { if (!$field->asa('CommonFieldsBehavior')) { throw new Exception('$field must have CommonFieldsBehavior'); } if ($field->required) { if (isset($htmlOptions['class'])) { $htmlOptions['class'] .= ' x2-required'; } else { $htmlOptions = array_merge(array('class' => 'x2-required'), $htmlOptions); } } $fieldName = $field->fieldName; if (!isset($field)) { return null; } switch ($field->type) { case 'text': return CHtml::activeTextArea($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel), array_merge(array('encode' => false), $htmlOptions))); case 'date': $oldDateVal = $model->{$fieldName}; $model->{$fieldName} = Formatter::formatDate($model->{$fieldName}, 'medium'); Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker'); $pickerOptions = array('dateFormat' => Formatter::formatDatePicker(), 'changeMonth' => false, 'changeYear' => true); if (Yii::app()->getLanguage() === 'fr') { $pickerOptions['monthNamesShort'] = Formatter::getPlainAbbrMonthNames(); } $input = Yii::app()->controller->widget('CJuiDateTimePicker', array('model' => $model, 'attribute' => $fieldName, 'mode' => 'date', 'options' => $pickerOptions, 'htmlOptions' => array_merge(array('title' => $field->attributeLabel), $htmlOptions), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()), true); $model->{$fieldName} = $oldDateVal; return $input; case 'dateTime': $oldDateTimeVal = $model->{$fieldName}; $pickerOptions = array('dateFormat' => Formatter::formatDatePicker('medium'), 'timeFormat' => Formatter::formatTimePicker(), 'ampm' => Formatter::formatAMPM(), 'changeMonth' => true, 'changeYear' => true); if (Yii::app()->getLanguage() === 'fr') { $pickerOptions['monthNamesShort'] = Formatter::getPlainAbbrMonthNames(); } $model->{$fieldName} = Formatter::formatDateTime($model->{$fieldName}); Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker'); $input = Yii::app()->controller->widget('CJuiDateTimePicker', array('model' => $model, 'attribute' => $fieldName, 'mode' => 'datetime', 'options' => $pickerOptions, 'htmlOptions' => array_merge(array('title' => $field->attributeLabel), $htmlOptions), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()), true); $model->{$fieldName} = $oldDateTimeVal; return $input; case 'dropdown': // Note: if desired to translate dropdown options, change the seecond argument to // $model->module $om = $field->getDropdownOptions(); $multi = (bool) $om['multi']; $dropdowns = $om['options']; $curVal = $multi ? CJSON::decode($model->{$field->fieldName}) : $model->{$field->fieldName}; $ajaxArray = array(); if ($field instanceof Fields) { $dependencyCount = X2Model::model('Dropdowns')->countByAttributes(array('parent' => $field->linkType)); $fieldDependencyCount = X2Model::model('Fields')->countByAttributes(array('modelName' => $field->modelName, 'type' => 'dependentDropdown', 'linkType' => $field->linkType)); if ($dependencyCount > 0 && $fieldDependencyCount > 0) { $ajaxArray = array('ajax' => array('type' => 'GET', 'url' => Yii::app()->controller->createUrl('/site/dynamicDropdown'), 'data' => 'js:{ "val":$(this).val(), "dropdownId":"' . $field->linkType . '", "field":true, "module":"' . $field->modelName . '" }', 'success' => ' function(data){ if(data){ data=JSON.parse(data); if(data[0] && data[1]){ $("#' . $field->modelName . '_"+data[0]).html(data[1]); } } }')); } } $htmlOptions = array_merge($htmlOptions, $ajaxArray, array('title' => $field->attributeLabel)); if ($multi) { $multiSelectOptions = array(); if (!is_array($curVal)) { $curVal = array(); } foreach ($curVal as $option) { $multiSelectOptions[$option] = array('selected' => 'selected'); } $htmlOptions = array_merge($htmlOptions, array('options' => $multiSelectOptions, 'multiple' => 'multiple')); } elseif ($field->includeEmpty) { $htmlOptions = array_merge($htmlOptions, array('empty' => Yii::t('app', "Select an option"))); } return CHtml::activeDropDownList($model, $field->fieldName, $dropdowns, $htmlOptions); case 'dependentDropdown': return CHtml::activeDropDownList($model, $field->fieldName, array('' => '-'), array_merge(array('title' => $field->attributeLabel), $htmlOptions)); case 'link': $linkSource = null; $linkId = ''; $name = ''; if (class_exists($field->linkType)) { // Create a model for autocompletion: if (!empty($model->{$fieldName})) { list($name, $linkId) = Fields::nameAndId($model->{$fieldName}); $linkModel = X2Model::getLinkedModelMock($field->linkType, $name, $linkId, true); } else { $linkModel = X2Model::model($field->linkType); } if ($linkModel instanceof X2Model && $linkModel->asa('X2LinkableBehavior') instanceof X2LinkableBehavior) { $linkSource = Yii::app()->controller->createUrl($linkModel->autoCompleteSource); $linkId = $linkModel->id; $oldLinkFieldVal = $model->{$fieldName}; $model->{$fieldName} = $name; } } static $linkInputCounter = 0; $hiddenInputId = $field->modelName . '_' . $fieldName . "_id" . $linkInputCounter++; $input = CHtml::hiddenField($field->modelName . '[' . $fieldName . '_id]', $linkId, array('id' => $hiddenInputId)) . Yii::app()->controller->widget('zii.widgets.jui.CJuiAutoComplete', array('model' => $model, 'attribute' => $fieldName, 'source' => $linkSource, 'value' => $name, 'options' => array('minLength' => '1', 'select' => 'js:function( event, ui ) { $("#' . $hiddenInputId . '"). val(ui.item.id); $(this).val(ui.item.value); return false; }', 'create' => $field->linkType == 'Contacts' ? 'js:function(event, ui) { $(this).data( "uiAutocomplete" )._renderItem = function(ul,item) { return $("<li>").data("item.autocomplete",item). append(x2.forms.renderContactLookup(item)). appendTo(ul); }; }' : ($field->linkType == 'BugReports' ? 'js:function(event, ui) { $(this).data( "uiAutocomplete" )._renderItem = function( ul, item ) { var label = "<a style=\\"line-height: 1;\\">" + item.label; label += "<span style=\\"font-size: 0.6em;\\">"; // add email if defined if(item.subject) { label += "<br>"; label += item.subject; } label += "</span>"; label += "</a>"; return $( "<li>" ) .data( "item.autocomplete", item ) .append( label ) .appendTo( ul ); }; }' : '')), 'htmlOptions' => array_merge(array('title' => $field->attributeLabel), $htmlOptions)), true); if (isset($oldLinkFieldVal)) { $model->{$fieldName} = $oldLinkFieldVal; } return $input; case 'rating': return Yii::app()->controller->widget('X2StarRating', array('model' => $model, 'attribute' => $field->fieldName, 'readOnly' => isset($htmlOptions['disabled']) && $htmlOptions['disabled'], 'minRating' => Fields::RATING_MIN, 'maxRating' => Fields::RATING_MAX, 'starCount' => Fields::RATING_MAX - Fields::RATING_MIN + 1, 'cssFile' => Yii::app()->theme->getBaseUrl() . '/css/rating/jquery.rating.css', 'htmlOptions' => $htmlOptions, 'callback' => 'function(value, link){ if (typeof x2 !== "undefined" && typeof x2.InlineEditor !== "undefined" && typeof x2.InlineEditor.ratingFields !== "undefined") { x2.InlineEditor.ratingFields["' . $field->modelName . '[' . $field->fieldName . ']"] = value; } }'), true); case 'boolean': $checkbox = CHtml::openTag('div', X2Html::mergeHtmlOptions($htmlOptions, array('class' => 'checkboxWrapper'))); $checkbox .= CHtml::activeCheckBox($model, $field->fieldName, array_merge(array('unchecked' => 0, 'title' => $field->attributeLabel), $htmlOptions)); $checkbox .= CHtml::closeTag('div'); return $checkbox; case 'assignment': $oldAssignmentVal = $model->{$fieldName}; $model->{$fieldName} = !empty($model->{$fieldName}) ? $field->linkType == 'multiple' && !is_array($model->{$fieldName}) ? explode(', ', $model->{$fieldName}) : $model->{$fieldName} : X2Model::getDefaultAssignment(); $dropdownList = CHtml::activeDropDownList($model, $fieldName, X2Model::getAssignmentOptions(true, true), array_merge(array('title' => $field->attributeLabel, 'id' => $field->modelName . '_' . $fieldName . '_assignedToDropdown', 'multiple' => $field->linkType == 'multiple' ? 'multiple' : null), $htmlOptions)); $model->{$fieldName} = $oldAssignmentVal; return $dropdownList; case 'optionalAssignment': // optional assignment for users (can be left blank) $users = User::getNames(); unset($users['Anyone']); return CHtml::activeDropDownList($model, $fieldName, $users, array_merge(array('title' => $field->attributeLabel, 'empty' => ''), $htmlOptions)); case 'visibility': $permissionsBehavior = Yii::app()->params->modelPermissions; return CHtml::activeDropDownList($model, $field->fieldName, $permissionsBehavior::getVisibilityOptions(), array_merge(array('title' => $field->attributeLabel, 'id' => $field->modelName . "_visibility"), $htmlOptions)); // 'varchar', 'email', 'url', 'int', 'float', 'currency', 'phone' // case 'int': // return CHtml::activeNumberField($model, $field->fieldNamearray_merge(array( // 'title' => $field->attributeLabel, // ), $htmlOptions)); // 'varchar', 'email', 'url', 'int', 'float', 'currency', 'phone' // case 'int': // return CHtml::activeNumberField($model, $field->fieldNamearray_merge(array( // 'title' => $field->attributeLabel, // ), $htmlOptions)); case 'percentage': $htmlOptions['class'] = empty($htmlOptions['class']) ? 'input-percentage' : $htmlOptions['class'] . ' input-percentage'; return CHtml::activeTextField($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel), $htmlOptions)); case 'currency': $fieldName = $field->fieldName; $elementId = isset($htmlOptions['id']) ? '#' . $htmlOptions['id'] : '#' . $field->modelName . '_' . $field->fieldName; Yii::app()->controller->widget('application.extensions.moneymask.MMask', array('element' => $elementId, 'currency' => Yii::app()->params['currency'], 'config' => array('affixStay' => true, 'decimal' => Yii::app()->locale->getNumberSymbol('decimal'), 'thousands' => Yii::app()->locale->getNumberSymbol('group')))); return CHtml::activeTextField($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel, 'class' => 'currency-field'), $htmlOptions)); case 'credentials': $typeAlias = explode(':', $field->linkType); $type = $typeAlias[0]; if (count($typeAlias) > 1) { $uid = Credentials::$sysUseId[$typeAlias[1]]; } else { $uid = Yii::app()->user->id; } return Credentials::selectorField($model, $field->fieldName, $type, $uid); case 'timerSum': // Sorry, no-can-do. This is field derives its value from a sum over timer records. return $model->renderAttribute($field->fieldName); case 'float': case 'int': if (isset($model->{$fieldName})) { $oldNumVal = $model->{$fieldName}; $model->{$fieldName} = Yii::app()->locale->numberFormatter->formatDecimal($model->{$fieldName}); } $input = CHtml::activeTextField($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel), $htmlOptions)); if (isset($oldNumVal)) { $model->{$fieldName} = $oldNumVal; } return $input; default: return CHtml::activeTextField($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel), $htmlOptions)); // array( // 'tabindex'=>isset($item['tabindex'])? $item['tabindex'] : null, // 'disabled'=>$item['readOnly']? 'disabled' : null, // 'title'=>$field->attributeLabel, // 'style'=>$default?'color:#aaa;':null, // )); } }
public static function generateFeedEmail($filters, $userId, $range, $limit, $eventId, $deleteKey) { $image = Yii::app()->getAbsoluteBaseUrl(true) . '/images/x2engine.png'; $msg = "<div id='wrap' style='width:6.5in;height:9in;margin-top:auto;margin-left:auto;margin-bottom:auto;margin-right:auto;'><html><body><center>"; $msg .= '<table border="0" cellpadding="0" cellspacing="0" height="100%" id="top-activity" style="background: white; font-family: \'Helvetica Neue\', \'Helvetica\', Helvetica, Arial, sans-serif; font-weight: normal; font-style: normal; font-size: 14px; line-height: 1; color: #222222; position: relative; -webkit-font-smoothing: antialiased;background-color:#FAFAFA;height:25% !important; margin:0; padding:0; width:100% !important;" width="100%">' . "<tbody><tr><td align=\"center\" style=\"padding-top:20px;\" valign=\"top\">" . '<table border="0" cellpadding="0" cellspacing="0" id="templateContainer" style="border: 1px solid #DDDDDD;background-color:#FFFFFF;" width="600"><tbody>'; $msg .= '<tr> <td align="center" valign="top"><!-- // Begin Template Header \\ --> <table border="0" cellpadding="0" cellspacing="0" id="templateHeader" width="600"> <tbody> <tr> <td class="headerContent" style="color:#202020;font-weight:bold;line-height:100%;padding:0;text-align:center;vertical-align:middle;font-family: inherit;font-weight: normal;font-size: 14px;margin-bottom: 17px"><img id="headerImage campaign-icon" src="' . $image . '" style="border:0; height:auto; line-height:100%; outline:none; text-decoration:none;max-width:600px;" /></td> </tr> <tr> <td style="color:#202020;font-weight:bold;padding:5px;text-align:center;vertical-align:middle;font-family: inherit;font-weight: normal;font-size: 14px;"><h2>' . Yii::t('profile', 'Activity Feed Report') . '</h2></td> </tr> </tbody> </table> <hr width="60%"></td><!-- // End Template Header \\ --> </tr>'; $msg .= '<tr><td align="center" valign="top"><!-- // Begin Template Body \\ -->' . '<table border="0" cellpadding="0" cellspacing="0" id="templateBody" width="600"><tbody><tr>' . '<td valign="top"><!-- // Begin Module: Standard Content \\ -->' . '<table border="0" cellpadding="20" cellspacing="0" width="100%"><tbody>'; $params = array(); $userRecord = X2Model::model('Profile')->findByPk($userId); $params[':username'] = $userRecord->username; $parsedFilters = Events::parseFilters($filters, $params); $visibilityCondition = $parsedFilters['conditions']['visibility']; $accessCriteria = Events::model()->getAccessCriteria(); $userCondition = $parsedFilters['conditions']['users']; $typeCondition = $parsedFilters['conditions']['types']; $subtypeCondition = $parsedFilters['conditions']['subtypes']; $condition = "type!='comment' AND (type!='action_reminder' " . "OR user=:username) AND " . "(type!='notif' OR user=:username)" . $visibilityCondition . $userCondition . $typeCondition . $subtypeCondition . ' AND (' . $accessCriteria->condition . ')'; switch ($range) { case 'daily': $timeRange = 24 * 60 * 60; break; case 'weekly': $timeRange = 7 * 24 * 60 * 60; break; case 'monthly': $timeRange = 30 * 24 * 60 * 60; break; default: $timeRange = 24 * 60 * 60; break; } $condition .= " AND timestamp BETWEEN " . (time() - $timeRange) . " AND " . time(); $topTypes = Yii::app()->db->createCommand()->select('type, COUNT(type)')->from('x2_events')->where($condition, array_merge($params, $accessCriteria->params))->group('type')->order('COUNT(type) DESC')->limit(5)->queryAll(); $topUsers = Yii::app()->db->createCommand()->select('user, COUNT(user)')->from('x2_events')->where($condition, array_merge($params, $accessCriteria->params))->group('user')->order('COUNT(user) DESC')->limit(5)->queryAll(); $msg .= "<tr><td style='text-align:center;'>"; $msg .= "<div>" . Yii::t('profile', "Here's your {range} update on what's been going on in X2Engine!", array('{range}' => Yii::t('profile', $range))) . "</div><br>" . "<div>Time Range: <em>" . Formatter::formatDateTime(time() - $timeRange) . "</em> to <em>" . Formatter::formatDateTime(time()) . "</em></div>"; $msg .= "</tr></td>"; $msg .= "<tr><td><table width='100%'><tbody>"; $msg .= "<tr><th>" . Yii::t('profile', "Top Activity") . "</th><th>" . Yii::t('profile', "Top Users") . "</th></tr>"; for ($i = 0; $i < 5; $i++) { $msg .= "<tr><td style='text-align:center;'>"; if (isset($topTypes[$i])) { $type = Events::parseType($topTypes[$i]['type']); $count = $topTypes[$i]['COUNT(type)']; $msg .= $count . " " . $type; } $msg .= "</td><td style='text-align:center;'>"; if (isset($topUsers[$i]) && $topUsers[$i]['COUNT(user)'] > 0) { $username = User::getUserLinks($topUsers[$i]['user'], false, true); $count = $topUsers[$i]['COUNT(user)']; $msg .= $count . " " . Yii::t('profile', "events from") . " " . $username . "."; } $msg .= "</td></tr>"; } $msg .= "</tbody></table></td></tr>"; $msg .= "<tr><td style='text-align:center'><hr width='60%'>"; $msg .= "<tr><td style='text-align:center;'>" . Yii::t('profile', "Here's the {limit} most recent items on the Activity Feed.", array('{limit}' => $limit)) . "</td></tr>"; $msg .= "</td></tr>"; $msg .= "<tr><td style='text-align:center'><hr width='60%'><table><tbody>"; $events = new CActiveDataProvider('Events', array('criteria' => array('condition' => $condition, 'order' => 'timestamp DESC', 'params' => array_merge($params, $accessCriteria->params)), 'pagination' => array('pageSize' => $limit))); foreach ($events->getData() as $event) { $msg .= "<tr>"; $avatar = Yii::app()->db->createCommand()->select('avatar')->from('x2_profile')->where('username=:user', array(':user' => $event->user))->queryScalar(); if (!empty($avatar) && file_exists($avatar)) { $avatar = Yii::app()->getAbsoluteBaseUrl() . '/' . $avatar; } else { $avatar = Yii::app()->getAbsoluteBaseUrl(true) . '/uploads/default.png'; } $typeFile = $event->type; if (in_array($event->type, array('email_sent', 'email_opened'))) { if (in_array($event->subtype, array('quote', 'invoice'))) { $typeFile .= "_{$event->subtype}"; } } if ($event->type == 'record_create') { switch ($event->subtype) { case 'call': $typeFile = 'voip_call'; break; case 'time': $typeFile = 'log_time'; break; } } $imgFile = $avatar; if (file_exists(Yii::app()->theme->getBasePath() . '/images/eventIcons/' . $typeFile . '.png')) { $imgFile = Yii::app()->getAbsoluteBaseUrl() . '/themes/' . Yii::app()->theme->getName() . '/images/eventIcons/' . $typeFile . '.png'; } $img = CHtml::image($imgFile, '', array('style' => 'width:45px;height:45px;float:left;margin-right:5px;')); $msg .= "<td>" . $img . "</td>"; $msg .= "<td style='text-align:left'><span class='event-text'>" . $event->getText(array('requireAbsoluteUrl' => true), array('style' => 'text-decoration:none;')) . "</span></td>"; $msg .= "</tr>"; } $msg .= "</tbody></table></td></tr>"; $msg .= "<tr><td style='text-align:center'><hr width='60%'><table><tbody>"; $msg .= Yii::t('profile', "To stop receiving this report, ") . CHtml::link(Yii::t('profile', 'click here'), Yii::app()->getAbsoluteBaseUrl() . '/index.php/profile/deleteActivityReport?id=' . $eventId . '&deleteKey=' . $deleteKey); $msg .= "</tbody></table></td></tr>"; $msg .= '</tbody></table></td></tr></tbody></table></td></tr>'; $msg .= "<tbody></table></td></tr></tbody></table></center></body></html></div>"; return $msg; }
<?php echo $data->getLink(); ?> </div> <div class="topic-attributes"> <div class="topic-reply-count"> <?php echo $data->renderAttribute('replyCount'); ?> </div> <div class="topic-last-updated"> <div class='avatar-container'> <?php echo Profile::renderFullSizeAvatar($data->lastPost->getAuthorId(), 30); ?> </div> <div class="topic-last-updated-text"> <?php echo User::getUserLinks($data->lastPost->updatedBy); ?> <br> <?php echo Formatter::formatDateTime($data->lastPost->createDate); ?> </div> </div> </div> </div> </div>
if (in_array($model->type, array('event', 'time', 'call'))) { echo "<div class='complete-date-container'>"; echo $form->label($model, 'completeDate'); if (is_numeric($model->completeDate)) { $model->completeDate = Formatter::formatDateTime($model->completeDate); } echo $form->textField($model, 'completeDate'); echo "</div>"; } echo "</span>"; echo "<div class='field-value'>"; echo "<span style='color:grey'>" . $model->getAttributeLabel('dueDate', true) . ':' . " </span>" . '<b>' . $model->formatDueDate() . '</b>'; echo "</div>"; if (in_array($model->type, array('event', 'time', 'call'))) { echo "<div class='field-value'>"; echo "<span style='color:grey'>" . $model->getAttributeLabel('completeDate', true) . ':' . " </span>" . '<b>' . Formatter::formatDateTime($model->completeDate) . '</b>'; echo "</div>"; } } elseif (!empty($model->createDate)) { echo Yii::t('actions', 'Created:') . " " . Formatter::formatLongDateTime($model->createDate) . '</b>'; } else { echo " "; } } else { echo Yii::t('actions', 'Completed {date}', array('{date}' => Formatter::formatCompleteDate($model->completeDate))); } ?> </span> <span> <span id="controls"> <?php
<div class="cell dialog-cell" style="float: none;"> <?php echo $model->actionDescription; ?> </div> </div> <div class="row"> <div class="cell dialog-cell"> <?php echo $form->label($model, $isEvent ? 'startDate' : 'dueDate', array('class' => 'dialog-label')); echo Formatter::formatDateTime($model->dueDate); //format date from DATETIME if ($isEvent) { echo $form->label($model, 'endDate', array('class' => 'dialog-label')); echo Formatter::formatDateTime($model->completeDate); //format date from DATETIME } echo $form->label($model, 'allDay', array('class' => 'dialog-label')); echo $form->checkBox($model, 'allDay', array('onChange' => 'giveSaveButtonFocus();', 'disabled' => 'disabled')); ?> </div> <div class="cell dialog-cell"> <?php echo $form->label($model, 'priority', array('class' => 'dialog-label')); $priorityArray = Actions::getPriorityLabels(); echo isset($priorityArray[$model->priority]) ? $priorityArray[$model->priority] : ""; ?> </div> <div class="cell dialog-cell">
?> <div class="cell"> <?php echo $form->labelEx($actionModel, 'startDate'); $actionModel->dueDate = Formatter::formatDateTime($actionModel->dueDate); echo X2Html::activeDatePicker($actionModel, 'dueDate', $form->resolveHtmlOptions($actionModel, 'dueDate', array('onClick' => "\$('#ui-datepicker-div').css('z-index', '20');")), 'datetime', array('dateFormat' => Formatter::formatDatePicker('medium'), 'timeFormat' => Formatter::formatTimePicker(), 'ampm' => Formatter::formatAMPM(), 'changeMonth' => false)); ?> </div> <?php } if ($actionModel->complete == 'Yes' || $actionModel->isTimedType) { ?> <div class="cell"> <?php echo $form->labelEx($actionModel, $actionModel->isTimedType ? 'endDate' : 'completeDate'); $actionModel->completeDate = Formatter::formatDateTime($actionModel->completeDate); echo X2Html::activeDatePicker($actionModel, 'completeDate', $form->resolveHtmlOptions($actionModel, 'completeDate', array('onClick' => "\$('#ui-datepicker-div').css('z-index', '20');")), 'datetime', array('dateFormat' => Formatter::formatDatePicker('medium'), 'timeFormat' => Formatter::formatTimePicker(), 'ampm' => Formatter::formatAMPM(), 'changeMonth' => false)); ?> </div> <?php } ?> </div><!-- #action-backdating --> </div><!-- .form --> <?php if (!$backdating && file_exists(__DIR__ . DIRECTORY_SEPARATOR . '_actionTimersForm.php') && $actionModel->complete == 'Yes') { $this->renderPartial('_actionTimersForm', array('model' => $actionModel, 'form' => $form)); } ?> </div> <?php
/** * @param CModel $model * @param string $attribute * @param array (optional) $htmlOptions * @return string */ public static function activeDatePicker(CModel $model, $attribute, array $htmlOptions = array(), $mode = 'date', array $options = array()) { $options = array_merge(array('dateFormat' => Formatter::formatDatePicker(), 'changeMonth' => true, 'changeYear' => true), $options); ob_start(); ob_implicit_flush(false); Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker'); $model->{$attribute} = Formatter::formatDateTime($model->{$attribute}); $renderWidget = function () use($model, $attribute, $htmlOptions, $mode, $options) { Yii::app()->controller->widget('CJuiDateTimePicker', array('model' => $model, 'attribute' => $attribute, 'mode' => $mode, 'options' => $options, 'htmlOptions' => $htmlOptions, 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage())); }; if (Yii::app()->controller->isAjaxRequest()) { // process output if this is an ajax request X2Widget::ajaxRender($renderWidget); } else { $renderWidget(); } return ob_get_clean(); }
public function getLastUpdateInfo() { if (!empty($this->updatedBy) && !empty($this->lastUpdated)) { return Formatter::formatDateTime($this->lastUpdated); } return ' '; }
</div> <div class='topic-text'> <div class='topic-timestamp-text'> <?php echo Yii::t('topics', 'Posted {datetime}.', array('{datetime}' => Formatter::formatDateTime($data->createDate, 'medium'))); ?> </div> <br> <?php echo Formatter::convertLineBreaks(x2base::convertUrls($data->text)); ?> <div class='topic-timestamp-text'> <br> <?php if ($data->isEdited()) { echo Yii::t('topics', 'Edited by {user} - {datetime}.', array('{user}' => User::getUserLinks($data->updatedBy, false, true), '{datetime}' => Formatter::formatDateTime($data->lastUpdated, 'medium'))); } ?> </div> </div> </div> <div class='topic-footer'> <?php if (count($data->attachments) > 0) { echo "<div class='topic-attachment-label'>"; echo Yii::t('topics', 'Attachments'); echo "</div>"; echo "<div class='topic-attachment-list'>"; foreach ($data->attachments as $media) { echo '<span class="x2-pillbox topic-attachment">' . $media->getMediaLink() . '</span>';
} ?> <li> <a class='edit-reply-button' href='<?php echo $this->createAbsoluteUrl('/topics/mobileUpdateReply', array('id' => $data->id)); ?> '><?php echo CHtml::encode(Yii::t('mobile', 'Edit')); ?> </a> </li> </ul> </div> <div class='create-date'> <?php echo Formatter::formatDateTime($data->createDate, 'medium'); ?> </div> <!--<div class='clearfix'></div>--> </div> <div class='reply-text'> <?php echo Formatter::convertLineBreaks(x2base::convertUrls($data->text)); ?> </div> <div class='reply-attachments'> <?php /*$found = false; foreach ($data->attachments as $attachment) {