function getFirstName() { if (Yii::app()->user->isGuest) { return ''; } else { return ellipsize(ucwords(getUserProfile(Yii::app()->user->id)->getAttribute('first_name')), 15) . (Yii::app()->user->isAdmin() ? '*' : ''); } }
public function test_ellipsize() { $strs = array('0' => array('this is my string' => '… my string', "here's another one" => '…nother one', 'this one is just a bit longer' => '…bit longer', 'short' => 'short'), '.5' => array('this is my string' => 'this …tring', "here's another one" => "here'…r one", 'this one is just a bit longer' => 'this …onger', 'short' => 'short'), '1' => array('this is my string' => 'this is my…', "here's another one" => "here's ano…", 'this one is just a bit longer' => 'this one i…', 'short' => 'short')); foreach ($strs as $pos => $s) { foreach ($s as $str => $expect) { $this->assertEquals($expect, ellipsize($str, 10, $pos)); } } }
public function ellipsis($data) { // Recieve inherited data passed to plugin from parent plugin $CI =& get_instance(); $CI->load->library('parser'); $CI->load->helper('text'); $content = $this->content(); $parsed_content = $CI->parser->parse_string($content, $data, TRUE); return ellipsize($parsed_content, $this->attribute('length')); }
public function plot($emptyerror = "") { if ($this->isEmpty()) { return $emptyerror; } else { load_js('flot'); $dataset = '['; foreach ($this->data as $name => $value) { $name = ellipsize($name, 17); $dataset .= '["' . $name . '", ' . $value . "], "; } if (strlen($dataset) > 1) { $dataset = substr($dataset, 0, -2); } $dataset .=']'; return ' <div class="flot-container" style="max-width: ' . $this->width . 'px; height: ' . $this->height . 'px;"> <p class="flot-title">' . $this->title . '</p> <div class="flot-placeholder" style="width:100%" id="placeholder' . $this->instanceID . '"></div> </div> <script type="text/javascript"> function doPlot' . $this->instanceID . '(data) { $.plot("#placeholder' . $this->instanceID . '", [ data ], { series: { bars: { show: true, barWidth: 0.8, align: "center" } } , xaxis: { mode: "categories", labelAngle: -45, tickLength: 0 } }); } $(function() { var data = ' . $dataset . '; doPlot' . $this->instanceID . '(data); window.onresize = function(event) { doPlot' . $this->instanceID . '(data); } }); </script>'; } }
public function edit($content_id) { $content = $this->content_model->get($content_id); if ($content === FALSE) { $this->postal->add('There is no content to edit.', 'error'); redirect('admin/contents/index', 'refresh'); } $this->data['content'] = $content; $this->data['parents'] = $this->content_model->get_parents_list($content->content_type, $content->id); $this->data['slugs'] = $this->slug_model->where(array('content_type' => $content->content_type, 'content_id' => $content->id))->get_all(); $rules = $this->content_model->rules; $this->form_validation->set_rules($rules['update']); if ($this->form_validation->run() === FALSE) { $this->render('admin/contents/edit_view'); } else { $content_id = $this->input->post('content_id'); $content = $this->content_model->get($content_id); if ($content !== FALSE) { $parent_id = $this->input->post('parent_id'); $title = $this->input->post('title'); $short_title = $this->input->post('short_title'); $slug = url_title(convert_accented_characters($this->input->post('slug')), '-', TRUE); $order = $this->input->post('order'); $text = $this->input->post('content'); $teaser = strlen($this->input->post('teaser')) > 0 ? $this->input->post('teaser') : substr($text, 0, strpos($text, '<!--more-->')); $page_title = strlen($this->input->post('page_title')) > 0 ? $this->input->post('page_title') : $title; $page_description = strlen($this->input->post('page_description')) > 0 ? $this->input->post('page_description') : ellipsize($teaser, 160); $page_keywords = $this->input->post('page_keywords'); $published_at = $this->input->post('published_at'); $update_data = array('title' => $title, 'short_title' => $short_title, 'teaser' => $teaser, 'content' => $text, 'page_title' => $page_title, 'page_description' => $page_description, 'page_keywords' => $page_keywords, 'parent_id' => $parent_id, 'published_at' => $published_at, 'order' => $order); if ($this->content_model->update($update_data, $content_id)) { if (strlen($slug) > 0) { $url = $this->_verify_slug($slug); $new_slug = array('content_type' => $content->content_type, 'content_id' => $content->id, 'url' => $url); if ($slug_id = $this->slug_model->insert($new_slug)) { $this->slug_model->where(array('content_type' => $content->content_type, 'id !=' => $slug_id))->update(array('redirect' => $slug_id, 'updated_by' => $this->user_id)); } } $this->rat->log('The user edited the content type "' . $content->content_type . '" with the ID: ' . $content->id . ' having "' . $content->title . '" as title.'); $this->postal->add('The content was updated successfully.', 'success'); } } else { $this->postal->add('There is no content to update.', 'error'); } redirect('admin/contents/index/' . $content->content_type, 'refresh'); } }
function getSidebarMessages() { global $uid, $urlServer, $langFrom, $dateFormatLong, $langDropboxNoMessage, $langMailSubject, $langCourse; $message_content = ''; $mbox = new Mailbox($uid, 0); $msgs = $mbox->getInboxMsgs(''); $msgs = array_filter($msgs, function ($msg) { return !$msg->is_read; }); if (!count($msgs)) { $message_content .= "<li class='list-item no-messages'>" . "<span class='item-wholeline'>" . $langDropboxNoMessage . "</span>" . "</li>"; } else { foreach ($msgs as $message) { if ($message->course_id > 0) { $course_title = q(ellipsize(course_id_to_title($message->course_id), 30)); } else { $course_title = ''; } $message_date = claro_format_locale_date($dateFormatLong, $message->timestamp); $message_content .= "<li class='list-item'> <span class='item-wholeline'> <div class='text-title'>$langFrom: " . display_user($message->author_id, false, false) . "<br> $langMailSubject: <a href='{$urlServer}modules/dropbox/index.php?mid=$message->id'>" . q($message->subject) . "</a> </div>"; if ($course_title) { $message_content .= "<div class='text-grey'>$langCourse: $course_title</div>"; } $message_content .= "<div>$message_date</div> </span> </li>"; } } return $message_content; }
function calendar($y = FALSE, $m = FALSE) { if (!$this->connected) { $this->layout = "layouts/public"; } $this->load->library('calendar'); $e = new Event(); $y = $y ? $y : date('Y'); $m = $m ? $m : date('m'); $events = $e->select('DAY(start) AS day,events.id,title,description,cost')->where('MONTH(start)', $m)->where('YEAR(start)', $y)->include_related('category', array('color'))->get_iterated(); $this->load->helper('text'); $ul = array(); foreach ($events as $e) { $ul[$e->day][] = '<span class="label" style="background:' . $e->category_color . ';">' . anchor('events/show/' . $e->id, ellipsize($e->title, 20, 1, '..'), 'id="' . $e->id . '" class="tip" data-toggle="modal" data-original-title="' . $e->title . '"') . '</span>'; } $data = array(); foreach ($ul as $day => $event) { $data[$day] = ul($event, array('class' => 'unstyled sortable')); } $this->data['calendar'] = $this->calendar->generate($y, $m, $data); $c = new Category(); $this->data['categories'] = $c->get_iterated(); }
/** * display action details in wiki * @global type $langTitle * @global type $langDescription * @param type $details * @return string */ private function wiki_action_details($details) { global $langTitle, $langDescription; $details = unserialize($details); $content = "{$langTitle} «" . q($details['title']) . "»"; if (!empty($details['description'])) { $content .= " — {$langDescription} «" . q(ellipsize($details['description'], 100)) . "»"; } return $content; }
<div class='col-sm-10'> $sections_table </div> </div> </div> </div>"; $q = Database::get()->queryArray("SELECT id, public_id, title FROM ebook_section WHERE ebook_id = ?d ORDER BY CONVERT(public_id, UNSIGNED), public_id", $info->id); $sections = array('' => '---'); foreach ($q as $section) { $sid = $section->id; $qsid = q($section->public_id); $qstitle = q($section->title); $sections[$sid] = $qsid . '. ' . ellipsize($section->title, 25); } $pageName = $langEBookPages; $tool_content .= action_bar(array( array('title' => $langNewEBookPage, 'url' => "new.php?course=$course_code&ebook_id=$ebook_id&from=ebookEdit", 'icon' => 'fa-plus-circle', 'button-class' => 'btn-success', 'level' => 'primary-label'), array('title' => $langFileAdmin, 'url' => "document.php?course=$course_code&ebook_id=$ebook_id", 'icon' => 'fa-hdd-o', 'level' => 'primary-label') )); // Form #3 - edit subsection file assignment $q = Database::get()->queryArray("SELECT ebook_section.id AS sid,
function _format_get(&$data) { // Add some date formats. if (isset($data[$this->table . 'UpdatedAt'])) { $data['DateFormat1'] = date('n/j/Y', strtotime($data[$this->table . 'UpdatedAt'])); } // Make a smaller file name. $this->load->helper('text'); if (isset($data['CMS_MediaFile'])) { $data['FileEllipse'] = ellipsize($data['CMS_MediaFile'], 32, 0.5); } switch ($data['CMS_MediaStore']) { case 'rackspace-cloud-files': $data['url'] = $this->data['cms']['cp_media_rackspace_url'] . $data['CMS_MediaPath'] . $data['CMS_MediaFile']; $data['sslurl'] = $this->data['cms']['cp_media_rackspace_ssl_url'] . $data['CMS_MediaPath'] . $data['CMS_MediaFile']; $data['thumburl'] = ''; $data['thumbsslurl'] = ''; // If image build a thumbnail if ($data['CMS_MediaIsImage']) { $data['thumburl'] = $this->data['cms']['cp_media_rackspace_url'] . $data['CMS_MediaPathThumb'] . $data['CMS_MediaFileThumb']; $data['thumbsslurl'] = $this->data['cms']['cp_media_rackspace_ssl_url'] . $data['CMS_MediaPathThumb'] . $data['CMS_MediaFileThumb']; } else { if ($data['CMS_MediaType'] == 'video') { $data['thumburl'] = $data['thumbsslurl'] = $this->data['cms']['assets_base'] . '/img/v-ico.png'; } else { $data['thumburl'] = $data['thumbsslurl'] = $this->data['cms']['assets_base'] . '/img/doc-ico.png'; } } break; case 'amazon-web-services-s3': $data['url'] = $this->data['cms']['cp_media_amazon_s3_url'] . $data['CMS_MediaPath'] . $data['CMS_MediaFile']; $data['sslurl'] = $this->data['cms']['cp_media_amazon_s3_ssl_url'] . $data['CMS_MediaPath'] . $data['CMS_MediaFile']; $data['thumburl'] = ''; $data['thumbsslurl'] = ''; // If image build a thumbnail if ($data['CMS_MediaIsImage']) { $data['thumburl'] = $this->data['cms']['cp_media_amazon_s3_url'] . $data['CMS_MediaPathThumb'] . $data['CMS_MediaFileThumb']; $data['thumbsslurl'] = $this->data['cms']['cp_media_amazon_s3_ssl_url'] . $data['CMS_MediaPathThumb'] . $data['CMS_MediaFileThumb']; } else { if ($data['CMS_MediaType'] == 'video') { $data['thumburl'] = $data['thumbsslurl'] = $this->data['cms']['assets_base'] . '/img/v-ico.png'; } else { $data['thumburl'] = $data['thumbsslurl'] = $this->data['cms']['assets_base'] . '/img/doc-ico.png'; } } break; case 'local-files': $data['url'] = $this->data['cms']['cp_media_local_url'] . $data['CMS_MediaPath'] . $data['CMS_MediaFile']; $data['sslurl'] = $this->data['cms']['cp_media_local_ssl_url'] . $data['CMS_MediaPath'] . $data['CMS_MediaFile']; $data['thumburl'] = ''; $data['thumbsslurl'] = ''; // If image build a thumbnail if ($data['CMS_MediaIsImage']) { $data['thumburl'] = $this->data['cms']['cp_media_local_url'] . $data['CMS_MediaPathThumb'] . $data['CMS_MediaFileThumb']; $data['thumbsslurl'] = $this->data['cms']['cp_media_local_ssl_url'] . $data['CMS_MediaPathThumb'] . $data['CMS_MediaFileThumb']; } else { if ($data['CMS_MediaType'] == 'video') { $data['thumburl'] = $data['thumbsslurl'] = $this->data['cms']['assets_base'] . '/img/v-ico.png'; } else { $data['thumburl'] = $data['thumbsslurl'] = $this->data['cms']['assets_base'] . '/img/doc-ico.png'; } } break; } return $data; }
function browse($iSurveyId) { if (!Permission::model()->hasSurveyPermission($iSurveyId, 'responses', 'read')) { $aData['surveyid'] = $iSurveyId; $message['title'] = gT('Access denied!'); $message['message'] = gT('You do not have sufficient rights to access this page.'); $message['class'] = "error"; $this->_renderWrappedTemplate('survey', array("message" => $message), $aData); Yii::app()->end(); } App()->getClientScript()->registerPackage('jqgrid'); App()->getClientScript()->registerScriptFile(App()->getAssetManager()->publish(ADMIN_SCRIPT_PATH . "listresponse.js")); $aData = $this->_getData($iSurveyId); $bHaveToken = $aData['surveyinfo']['anonymized'] == "N" && tableExists('tokens_' . $iSurveyId) && Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'read'); // Boolean : show (or not) the token $aData['menu']['edition'] = false; extract($aData); $aViewUrls = array(); $sBrowseLanguage = $aData['language']; // Some specific column $aSpecificColumns = array('submitdate', 'token', 'id', 'lastpage'); // The column model must be built dynamically, since the columns will differ from survey to survey, depending on the questions. $column_model = array(); // The first few colums are fixed. $column_model[] = array('name' => 'actions', 'index' => 'actions', 'sorttype' => 'string', 'sortable' => false, 'width' => '100', 'resizable' => true, 'align' => 'left', 'label' => gT("Actions"), 'search' => false, 'hidedlg' => true); $fields = createFieldMap($iSurveyId, 'full', true, false, $aData['language']); // Specific columns at start $column_model[] = array('name' => 'id', 'index' => 'id', 'sorttype' => 'integer', 'sortable' => true, 'width' => '100', 'resizable' => true, 'align' => 'center', 'title' => viewHelper::getFieldText($fields['id']), 'hidedlg' => true); $column_model[] = array('name' => 'lastpage', 'index' => 'lastpage', 'sorttype' => 'integer', 'sortable' => true, 'width' => '100', 'resizable' => true, 'align' => 'center', 'title' => viewHelper::getFieldText($fields['lastpage'])); $bHidden = false; if (isset($_SESSION['survey_' . $iSurveyId]['HiddenFields'])) { $bHidden = in_array('completed', $_SESSION['survey_' . $iSurveyId]['HiddenFields']); } $column_model[] = array('name' => 'completed', 'index' => 'completed', 'sorttype' => 'string', 'stype' => 'select', 'editoptions' => array('value' => array("" => gT("All"), "Y" => gT("Yes"), "N" => gT("No"))), 'sortable' => true, 'hidden' => $bHidden, 'width' => '100', 'align' => 'center', 'label' => gT("Completed")); // defaultSearch is the default search done before send request in json. Actually : completed and token only. Can be extended ( js is ready) ? $defaultSearch = array(); if (incompleteAnsFilterState() == "incomplete") { $defaultSearch['completed'] = "N"; } elseif (incompleteAnsFilterState() == "complete") { $defaultSearch['completed'] = "Y"; } else { $defaultSearch['completed'] = ""; } //add token to top of list if survey is not private if ($bHaveToken) { $column_model[] = array('name' => 'token', 'index' => 'token', 'sorttype' => 'string', 'sortable' => true, 'width' => '150', 'align' => 'left', 'title' => gT('Token')); $column_model[] = array('name' => 'firstname', 'index' => 'firstname', 'sorttype' => 'string', 'sortable' => true, 'width' => '150', 'align' => 'left', 'title' => gT('First name')); $column_model[] = array('name' => 'lastname', 'index' => 'lastname', 'sorttype' => 'string', 'sortable' => true, 'width' => '150', 'align' => 'left', 'title' => gT('Last Name')); $column_model[] = array('name' => 'email', 'index' => 'email', 'sorttype' => 'string', 'sortable' => true, 'width' => '150', 'align' => 'left', 'title' => gT('Email')); // If token exist, test if token is set in params, add it to defaultSearch if ($sTokenSearch = Yii::app()->request->getQuery('token')) { $defaultSearch['token'] = $sTokenSearch; } } // All other columns are based on the questions. // An array to control unicity of $code (EM code) $aCodes = array(); foreach ($fields as $fielddetails) { if (in_array($fielddetails['fieldname'], $aSpecificColumns)) { continue; } // no headers for time data if ($fielddetails['type'] == 'interview_time') { continue; } if ($fielddetails['type'] == 'page_time') { continue; } if ($fielddetails['type'] == 'answer_time') { continue; } $question = $fielddetails['question']; if ($fielddetails['type'] == "|") { $fnames = array(); $code = viewHelper::getFieldCode($fielddetails, array('LEMcompat' => true)); // This must be unique ...... if ($fielddetails['aid'] !== 'filecount') { $qidattributes = getQuestionAttributeValues($fielddetails['qid']); for ($i = 0; $i < $qidattributes['max_num_of_files']; $i++) { if ($qidattributes['show_title'] == 1) { $fnames[] = array($code . '_' . $i . '_title', "File " . ($i + 1) . " - " . $fielddetails['question'] . "(Title)", "type" => "|", "metadata" => "title", "index" => $i); } if ($qidattributes['show_comment'] == 1) { $fnames[] = array($code . '_' . $i . '_comment', "File " . ($i + 1) . " - " . $fielddetails['question'] . "(Comment)", "type" => "|", "metadata" => "comment", "index" => $i); } $fnames[] = array($code . '_' . $i . '_name', "File " . ($i + 1) . " - " . $fielddetails['question'] . "(File name)", "type" => "|", "metadata" => "name", "index" => $i); $fnames[] = array($code . '_' . $i . '_size', "File " . ($i + 1) . " - " . $fielddetails['question'] . "(File size)", "type" => "|", "metadata" => "size", "index" => $i); } } else { $fnames[] = array($code . '_count', "File count"); } $bHidden = false; if (isset($_SESSION['survey_' . $iSurveyId]['HiddenFields'])) { $bHidden = in_array($fielddetails['fieldname'], $_SESSION['survey_' . $iSurveyId]['HiddenFields']); } foreach ($fnames as $aFileInfoField) { $column_model[] = array('name' => $aFileInfoField[0], 'index' => $aFileInfoField[0], 'sortable' => false, 'width' => '150', 'align' => 'left', 'editable' => false, 'search' => false, 'hidden' => $bHidden, 'title' => $aFileInfoField[1]); } continue; } // TODO: upload question type have more than one column (see before) // Construction of clean name and title $code = viewHelper::getFieldCode($fielddetails, array('LEMcompat' => true)); // This must be unique ...... //fix unicity of $code if (isset($aCodes[$code])) { $aCodes[$code]++; $code = "{$code}-{$aCodes[$code]}"; } else { $aCodes[$code] = 0; } $text = viewHelper::getFieldText($fielddetails); $textabb = viewHelper::getFieldText($fielddetails, array('abbreviated' => 10)); $bHidden = false; if (isset($_SESSION['survey_' . $iSurveyId]['HiddenFields'])) { $bHidden = in_array($fielddetails['fieldname'], $_SESSION['survey_' . $iSurveyId]['HiddenFields']); } $column_model[] = array('name' => $code, 'index' => $fielddetails['fieldname'], 'sorttype' => 'string', 'sortable' => true, 'width' => '200', 'align' => 'left', 'editable' => false, 'hidden' => (bool) $bHidden, 'title' => $text); } $column_model_txt = ls_json_encode($column_model); $column_names = array(); foreach ($column_model as $column) { if (isset($column['title'])) { $column_names[] = "<strong class='qcode'>{$column['name']}</strong> <span class='separator hidden'>:</span> <span class='questiontext'>" . ellipsize($column['title'], 30, 0.6, "...") . "</span>"; } elseif (isset($column['label'])) { $column_names[] = $column['label']; } else { $column_names[] = $column['name']; } } $aData['sortorder'] = Yii::app()->request->getQuery('order', 'asc'); $aData['limit'] = Yii::app()->request->getQuery('limit', 25); $aData['page'] = intval(Yii::app()->request->getQuery('start', 0)) + 1; $aData['issuperadmin'] = Permission::model()->hasGlobalPermission('superadmin'); $aData['surveyid'] = $iSurveyId; $aData['column_model_txt'] = $column_model_txt; $aData['column_names_txt'] = ls_json_encode($column_names); $aData['hasUpload'] = hasFileUploadQuestion($iSurveyId); $aData['jsonBaseUrl'] = App()->createUrl('/admin/responses', array('surveyid' => $iSurveyId, 'browselang' => $sBrowseLanguage)); $aData['jsonUrl'] = App()->createUrl('/admin/responses', array('sa' => 'getResponses_json', 'surveyid' => $iSurveyId, 'browselang' => $sBrowseLanguage, 'statfilter' => App()->request->getQuery('statfilter', 0))); $aData['jsonActionUrl'] = App()->createUrl('/admin/responses', array('sa' => 'actionResponses', 'surveyid' => $iSurveyId, 'browselang' => $sBrowseLanguage)); $aData['defaultSearch'] = json_encode($defaultSearch); $aViewUrls = array(); if (App()->request->getQuery('statfilter')) { $aViewUrls[] = 'filterListResponses_view'; } $aViewUrls[] = 'listResponses_view'; $this->_renderWrappedTemplate('responses', $aViewUrls, $aData); }
public function getExtendedData($colName, $sLanguage, $base64jsonFieldMap) { $oFieldMap = json_decode(base64_decode($base64jsonFieldMap)); $value = $this->{$colName}; $sFullValue = strip_tags(getExtendedAnswer(self::$sid, $oFieldMap->fieldname, $value, $sLanguage)); if (strlen($sFullValue) > 50) { $sElipsizedValue = ellipsize($sFullValue, $this->ellipsize_question_value); $sValue = '<span data-toggle="tooltip" data-placement="left" title="' . quoteText($sFullValue) . '">' . $sElipsizedValue . '</span>'; } else { $sValue = $sFullValue; } // Upload question if ($oFieldMap->type == '|' && strpos($oFieldMap->fieldname, 'filecount') === false) { $sSurveyEntry = "<table class='table table-condensed upload-question'><tr>"; $aQuestionAttributes = getQuestionAttributeValues($oFieldMap->qid); $aFilesInfo = json_decode_ls($this->{$colName}); for ($iFileIndex = 0; $iFileIndex < $aQuestionAttributes['max_num_of_files']; $iFileIndex++) { $sSurveyEntry .= '<tr>'; if (isset($aFilesInfo[$iFileIndex])) { $sSurveyEntry .= '<td>' . CHtml::link(rawurldecode($aFilesInfo[$iFileIndex]['name']), App()->createUrl("/admin/responses", array("sa" => "actionDownloadfile", "surveyid" => self::$sid, "iResponseId" => $this->id, "sFileName" => $aFilesInfo[$iFileIndex]['name']))) . '</td>'; $sSurveyEntry .= '<td>' . sprintf('%s Mb', round($aFilesInfo[$iFileIndex]['size'] / 1000, 2)) . '</td>'; if ($aQuestionAttributes['show_title']) { if (!isset($aFilesInfo[$iFileIndex]['title'])) { $aFilesInfo[$iFileIndex]['title'] = ''; } $sSurveyEntry .= '<td>' . htmlspecialchars($aFilesInfo[$iFileIndex]['title'], ENT_QUOTES, 'UTF-8') . '</td>'; } if ($aQuestionAttributes['show_comment']) { if (!isset($aFilesInfo[$iFileIndex]['comment'])) { $aFilesInfo[$iFileIndex]['comment'] = ''; } $sSurveyEntry .= '<td>' . htmlspecialchars($aFilesInfo[$iFileIndex]['comment'], ENT_QUOTES, 'UTF-8') . '</td>'; } } $sSurveyEntry .= '</tr>'; } $sSurveyEntry .= '</table>'; $sValue = $sSurveyEntry; } return $sValue; }
/** * Function draw * * This method processes all data to render the display. It is executed by * each tool. Is in charge of generating the interface and parse it to the user's browser. * * @param mixed $toolContent html code * @param int $menuTypeID * @param string $tool_css (optional) catalog name where a "tool.css" file exists * @param string $head_content (optional) code to be added to the HEAD of the UI * @param string $body_action (optional) code to be added to the BODY tag */ function draw($toolContent, $menuTypeID, $tool_css = null, $head_content = null, $body_action = null, $hideLeftNav = null, $perso_tool_content = null) { global $session, $course_code, $course_id, $helpTopic, $is_editor, $langActivate, $langNote, $langAdmin, $langAdvancedSearch, $langAnonUser, $langChangeLang, $langChooseLang, $langDeactivate, $langProfileMenu, $langEclass, $langHelp, $langUsageTerms, $langHomePage, $langLogin, $langLogout, $langMyPersoAgenda, $langMyAgenda, $langMyPersoAnnouncements, $langMyPersoDeadlines, $langMyPersoDocs, $langMyPersoForum, $langMyCourses, $langPortfolio, $langSearch, $langUser, $langUserPortfolio, $langUserHeader, $language, $navigation, $pageName, $toolName, $sectionName, $currentCourseName, $require_current_course, $require_course_admin, $require_help, $siteName, $siteName, $switchLangURL, $theme, $themeimg, $toolContent_ErrorExists, $urlAppend, $urlServer, $theme_settings, $language, $saved_is_editor, $langProfileImage, $langStudentViewEnable, $langStudentViewDisable, $langNoteTitle, $langEnterNote, $langFieldsRequ; // negative course_id might be set in common documents if ($course_id < 1) { unset($course_id); unset($course_code); } // get blocks content from $toolContent array if ($perso_tool_content) { $lesson_content = $perso_tool_content['lessons_content']; $personal_calendar_content = $perso_tool_content['personal_calendar_content']; } function get_theme_class($class) { global $theme_settings; if (isset($theme_settings['classes'][$class])) { return $theme_settings['classes'][$class]; } else { return $class; } } if (!$toolName and $pageName) { $toolName = $pageName; } elseif (!$pageName and $toolName) { $pageName = $toolName; } $pageTitle = $siteName; $is_mobile = isset($_SESSION['mobile']) && $_SESSION['mobile'] == true; $is_embedonce = isset($_SESSION['embedonce']) && $_SESSION['embedonce'] == true; unset($_SESSION['embedonce']); //get the left side menu from tools.php $toolArr = $is_mobile ? array() : getSideMenu($menuTypeID); $numOfToolGroups = count($toolArr); $GLOBALS['head_content'] = ''; $head_content .= $GLOBALS['head_content']; $t = new Template('template/' . $theme); if ($is_embedonce) { $template_file = 'embed.html'; } else { $template_file = 'theme.html'; } $t->set_file('fh', $template_file); $t->set_block('fh', 'mainBlock', 'main'); // template_callback() can be defined in theme settings.php if (function_exists('template_callback')) { template_callback($t, $menuTypeID, $is_embedonce); } $t->set_var('LANG', $language); $t->set_var('ECLASS_VERSION', ECLASS_VERSION); if (!$is_embedonce) { // Remove search if not enabled if (!get_config('enable_search')) { $t->set_block('mainBlock', 'searchBlock', 'delete'); } $t->set_var('leftNavClass', 'no-embed'); } // BEGIN constructing of left navigation // ---------------------------------------------------------------------- $t->set_block('mainBlock', 'leftNavBlock', 'leftNav'); $t->set_block('leftNavBlock', 'leftNavCategoryBlock', 'leftNavCategory'); $t->set_block('leftNavCategoryBlock', 'leftNavCategoryTitleBlock', 'leftNavCategoryTitle'); $t->set_block('leftNavCategoryBlock', 'leftNavLinkBlock', 'leftNavLink'); $t->set_var('template_base', $urlAppend . 'template/' . $theme); $t->set_var('img_base', $themeimg); $current_module_dir = module_path($_SERVER['REQUEST_URI']); if (!$is_mobile and !$hideLeftNav) { if (is_array($toolArr)) { $group_opened = false; for ($i = 0; $i < $numOfToolGroups; $i++) { if (!$is_embedonce) { $t->set_var('NAV_BLOCK_CLASS', $toolArr[$i][0]['class']); $t->set_var('TOOL_GROUP_ID', $i); if ($toolArr[$i][0]['type'] == 'none') { $t->set_var('ACTIVE_TOOLS', ' '); $t->set_var('NAV_CSS_CAT_CLASS', 'spacer'); } elseif ($toolArr[$i][0]['type'] == 'split') { $t->set_var('ACTIVE_TOOLS', ' '); $t->set_var('NAV_CSS_CAT_CLASS', 'split'); } elseif ($toolArr[$i][0]['type'] == 'text') { $t->set_var('ACTIVE_TOOLS', $toolArr[$i][0]['text']); $t->set_var('NAV_CSS_CAT_CLASS', 'category'); } $t->parse('leftNavCategoryTitle', 'leftNavCategoryTitleBlock', false); } $t->set_var('GROUP_CLASS', ''); $numOfTools = count($toolArr[$i][1]); for ($j = 0; $j < $numOfTools; $j++) { $t->set_var('TOOL_LINK', $toolArr[$i][2][$j]); $t->set_var('TOOL_TEXT', $toolArr[$i][1][$j]); if (is_external_link($toolArr[$i][2][$j]) or $toolArr[$i][3][$j] == 'fa-external-link') { $t->set_var('TOOL_EXTRA', ' target="_blank"'); } else { $t->set_var('TOOL_EXTRA', ''); } $t->set_var('IMG_FILE', $toolArr[$i][3][$j]); $img_class = basename($toolArr[$i][3][$j], ".png"); $img_class = preg_replace('/_(on|off)$/', '', $img_class); if (isset($theme_settings['icon_map'][$img_class])) { $img_class = $theme_settings['icon_map'][$img_class]; } $t->set_var('IMG_CLASS', $img_class); $module_dir = module_path($toolArr[$i][2][$j]); if ($module_dir == $current_module_dir) { $t->set_var('TOOL_CLASS', get_theme_class('tool_active')); $t->set_var('GROUP_CLASS', get_theme_class('group_active')); $group_opened = true; } else { $t->set_var('TOOL_CLASS', ''); } $t->parse('leftNavLink', 'leftNavLinkBlock', true); } if (!$group_opened and ($current_module_dir == '/' or $current_module_dir == 'course_home' or $current_module_dir == 'units' or $current_module_dir == 'weeks' or $current_module_dir == 'main/portfolio.php')) { $t->set_var('GROUP_CLASS', get_theme_class('group_active')); $group_opened = true; } $t->parse('leftNavCategory', 'leftNavCategoryBlock', true); $t->clear_var('leftNavLink'); //clear inner block } $t->parse('leftNav', 'leftNavBlock', true); } } $t->set_var('URL_PATH', $urlAppend); $t->set_var('SITE_NAME', $siteName); $t->set_var('FAVICON_PATH', $urlAppend . 'template/favicon/favicon.ico'); $t->set_var('ICON_PATH', $urlAppend . 'template/favicon/openeclass_128x128.png'); //If there is a message to display, show it (ex. Session timeout) if ($messages = Session::getMessages()) { $t->set_var('EXTRA_MSG', "<div class='row'><div class='col-xs-12'>" . $messages . "</div></div>"); } $t->set_var('TOOL_CONTENT', $toolContent); if (isset($GLOBALS['leftNavExtras'])) { $t->set_var('ECLASS_LEFTNAV_EXTRAS', $GLOBALS['leftNavExtras']); } // if user is logged in display the logout option if (isset($_SESSION['uid'])) { $t->set_var('LANG_USER', q($langUserHeader)); $t->set_var('USER_NAME', q($_SESSION['givenname'])); $t->set_var('USER_SURNAME', q($_SESSION['surname'])); $t->set_var('LANG_USER_ICON', $langProfileMenu); $t->set_var('USER_ICON', user_icon($_SESSION['uid'])); $t->set_var('USERNAME', q($_SESSION['uname'])); $t->set_var('LANG_PROFILE', q($GLOBALS['langMyProfile'])); $t->set_var('PROFILE_LINK', $urlAppend . 'main/profile/display_profile.php'); $t->set_var('LANG_MESSAGES', q($GLOBALS['langMyDropBox'])); $t->set_var('MESSAGES_LINK', $urlAppend . 'modules/dropbox/index.php'); $t->set_var('LANG_COURSES', q($GLOBALS['langMyCourses'])); $t->set_var('COURSES_LINK', $urlAppend . 'main/my_courses.php'); $t->set_var('LANG_AGENDA', q($langMyAgenda)); $t->set_var('AGENDA_LINK', $urlAppend . 'main/personal_calendar/index.php'); $t->set_var('LANG_NOTES', q($GLOBALS['langNotes'])); $t->set_var('NOTES_LINK', $urlAppend . 'main/notes/index.php'); $t->set_var('LANG_STATS', q($GLOBALS['langMyStats'])); $t->set_var('STATS_LINK', $urlAppend . 'main/profile/personal_stats.php'); $t->set_var('LANG_LOGOUT', q($langLogout)); $t->set_var('LOGOUT_LINK', $urlAppend . 'index.php?logout=yes'); $t->set_var('MY_COURSES', q($GLOBALS['langMyCoursesSide'])); $t->set_var('MY_MESSAGES', q($GLOBALS['langNewMyMessagesSide'])); $t->set_var('LANG_ANNOUNCEMENTS', q($GLOBALS['langMyAnnouncements'])); $t->set_var('ANNOUNCEMENTS_LINK', $urlAppend . 'modules/announcements/myannouncements.php'); if (!$is_embedonce) { if (get_config('personal_blog')) { $t->set_var('LANG_MYBLOG', q($GLOBALS['langMyBlog'])); $t->set_var('MYBLOG_LINK', $urlAppend . 'modules/blog/index.php'); } elseif ($menuTypeID > 0) { $t->set_block('mainBlock', 'PersoBlogBlock', 'delete'); } if ($session->status == USER_TEACHER and get_config('mydocs_teacher_enable') or $session->status == USER_STUDENT and get_config('mydocs_student_enable')) { $t->set_var('LANG_MYDOCS', q($GLOBALS['langMyDocs'])); $t->set_var('MYDOCS_LINK', $urlAppend . 'main/mydocs/index.php'); } elseif ($menuTypeID > 0) { $t->set_block('mainBlock', 'MyDocsBlock', 'delete'); } } $t->set_var('QUICK_NOTES', q($GLOBALS['langQuickNotesSide'])); $t->set_var('langSave', q($GLOBALS['langSave'])); $t->set_var('langAllNotes', q($GLOBALS['langAllNotes'])); $t->set_var('langAllMessages', q($GLOBALS['langAllMessages'])); $t->set_var('langNoteTitle', q($langNoteTitle)); $t->set_var('langEnterNoteLabel', $langNote); $t->set_var('langEnterNote', q($langEnterNote)); $t->set_var('langFieldsRequ', q($langFieldsRequ)); $t->set_var('LOGGED_IN', 'true'); } else { if (get_config('hide_login_link')) { $t->set_block('mainBlock', 'LoginIconBlock', 'delete'); } else { $next = str_replace($urlAppend, '/', $_SERVER['REQUEST_URI']); if (preg_match('@(?:^/(?:modules|courses)|listfaculte|opencourses|openfaculties)@', $next)) { $nextParam = '?next=' . urlencode($next); } else { $nextParam = ''; } $t->set_var('LANG_LOGOUT', $langLogin); $t->set_var('LOGOUT_LINK', $urlServer . 'main/login_form.php' . $nextParam); } $t->set_var('LOGGED_IN', 'false'); } if (isset($require_current_course) and !isset($sectionName)) { $sectionName = $currentCourseName; } // set the text and icon on the third bar (header) if ($menuTypeID == 2) { if (!$pageName) { $t->set_var('SECTION_TITLE', q($currentCourseName)); } else { $t->set_var('SECTION_TITLE', "<a href='{$urlServer}courses/{$course_code}/'>" . q($currentCourseName) . '</a>'); } } elseif ($menuTypeID == 3) { $t->set_var('SECTION_TITLE', $langAdmin); $sectionName = $langAdmin; } elseif ($menuTypeID > 0 and $menuTypeID < 3) { $t->set_var('SECTION_TITLE', $langUserPortfolio); $sectionName = $langUserPortfolio; } else { $t->set_var('SECTION_TITLE', $langEclass); $sectionName = $langEclass; } //set the appropriate search action for the searchBox form if ($menuTypeID == 2) { $searchAction = "search_incourse.php?all=true"; $searchAdvancedURL = $searchAction; } elseif ($menuTypeID == 1 || $menuTypeID == 3) { $searchAction = "search.php"; $searchAdvancedURL = $searchAction; } else { //$menuType == 0 $searchAction = "search.php"; $searchAdvancedURL = $searchAction; } $mod_activation = ''; if ($is_editor and isset($course_code)) { // link for activating / deactivating module $module_id = current_module_id(); if (display_activation_link($module_id)) { if (visible_module($module_id)) { $modIconClass = 'fa-minus-square tiny-icon-red'; $modIconTitle = q($langDeactivate); $modState = 0; } else { $modIconClass = 'fa-check-square tiny-icon-green'; $modIconTitle = q($langActivate); $modState = 1; } $mod_activation = "<a href='{$urlAppend}main/module_toggle.php?course={$course_code}&module_id={$module_id}' id='module_toggle' data-state='{$modState}' data-toggle='tooltip' data-placement='top' title='{$modIconTitle}'><span class='fa tiny-icon {$modIconClass}'></span></a>"; } } $t->set_var('SEARCH_ACTION', $searchAction); $t->set_var('SEARCH_ADVANCED_URL', $searchAdvancedURL); $t->set_var('SEARCH_TITLE', $langSearch); $t->set_var('SEARCH_ADVANCED', $langAdvancedSearch); $t->set_var('LANG_PORTFOLIO', $langPortfolio); $t->set_var('TOOL_NAME', $toolName); if ($is_editor) { $t->set_var('ACTIVATE_MODULE', $mod_activation); } if (!$t->get_var('LANG_SELECT')) { if ($menuTypeID != 2) { $t->set_var('LANG_SELECT', lang_selections()); $t->set_var('LANG_SELECT_TITLE', "title='{$langChooseLang}'"); } else { $t->set_var('LANG_SELECT', ''); } } // breadcrumb and page title if (!$is_embedonce and !$is_mobile and $current_module_dir != '/') { $t->set_block('mainBlock', 'breadCrumbLinkBlock', 'breadCrumbLink'); $t->set_block('mainBlock', 'breadCrumbEntryBlock', 'breadCrumbEntry'); // Breadcrumb first entry (home / portfolio) if ($session->status != USER_GUEST) { if (isset($_SESSION['uid'])) { $t->set_var('BREAD_TEXT', '<span class="fa fa-home"></span> ' . $langPortfolio); $t->set_var('BREAD_HREF', $urlAppend . 'main/portfolio.php'); } else { $t->set_var('BREAD_TEXT', $langHomePage); $t->set_var('BREAD_HREF', $urlAppend); } if (isset($require_current_course) or $pageName) { $t->parse('breadCrumbEntry', 'breadCrumbLinkBlock', true); } else { $t->parse('breadCrumbEntry', 'breadCrumbEntryBlock', true); } } // Breadcrumb course home entry if (isset($course_code)) { $t->set_var('BREAD_TEXT', q(ellipsize($currentCourseName, 48))); if ($pageName) { $t->set_var('BREAD_HREF', $urlAppend . 'courses/' . $course_code . '/'); $t->parse('breadCrumbEntry', 'breadCrumbLinkBlock', true); } else { $t->parse('breadCrumbEntry', 'breadCrumbEntryBlock', true); } $pageTitle .= " | " . ellipsize($currentCourseName, 32); } foreach ($navigation as $step) { $t->set_var('BREAD_TEXT', q($step['name'])); if (isset($step['url'])) { $t->set_var('BREAD_HREF', $step['url']); $t->parse('breadCrumbEntry', 'breadCrumbLinkBlock', true); } else { $t->parse('breadCrumbEntry', 'breadCrumbEntryBlock', true); } } if ($pageName) { $t->set_var('BREAD_TEXT', q($pageName)); $t->parse('breadCrumbEntry', 'breadCrumbEntryBlock', true); } if ($pageName) { $pageTitle .= " | " . $pageName; } } else { if (!$is_embedonce) { $t->set_block('mainBlock', 'breadCrumbs', 'delete'); } } //END breadcrumb -------------------------------- $t->set_var('PAGE_TITLE', q($pageTitle)); if (isset($course_code)) { $t->set_var('COURSE_CODE', $course_code); $t->set_var('COURSE_ID', $course_id); } if (!$is_embedonce) { if ($is_mobile) { $t->set_block('mainBlock', 'normalViewOpenDiv', 'delete'); $t->set_block('mainBlock', 'headerBlock', 'delete'); } else { $t->set_block('mainBlock', 'mobileViewOpenDiv', 'delete'); } } // Add Theme Options styles $t->set_var('logo_img', $themeimg . '/eclass-new-logo.png'); $t->set_var('logo_img_small', $themeimg . '/logo_eclass_small.png'); $t->set_var('container', 'container'); $theme_id = isset($_SESSION['theme_options_id']) ? $_SESSION['theme_options_id'] : get_config('theme_options_id'); if ($theme_id) { $theme_options = Database::get()->querySingle("SELECT * FROM theme_options WHERE id = ?d", $theme_id); $theme_options_styles = unserialize($theme_options->styles); $urlThemeData = $urlAppend . 'courses/theme_data/' . $theme_id; $styles_str = ''; if (!empty($theme_options_styles['bgColor']) || !empty($theme_options_styles['bgImage'])) { $background_type = ""; if (isset($theme_options_styles['bgType']) && $theme_options_styles['bgType'] == 'stretch') { $background_type .= "background-size: 100% 100%;"; } elseif (isset($theme_options_styles['bgType']) && $theme_options_styles['bgType'] == 'fix') { $background_type .= "background-size: 100% 100%;background-attachment: fixed;"; } $bg_image = isset($theme_options_styles['bgImage']) ? " url('{$urlThemeData}/{$theme_options_styles['bgImage']}')" : ""; $bg_color = isset($theme_options_styles['bgColor']) ? $theme_options_styles['bgColor'] : ""; $styles_str .= "body{background: {$bg_color}{$bg_image};{$background_type}}"; } $gradient_str = 'radial-gradient(closest-corner at 30% 60%, #009BCF, #025694)'; if (!empty($theme_options_styles['loginJumbotronBgColor']) && !empty($theme_options_styles['loginJumbotronRadialBgColor'])) { $gradient_str = "radial-gradient(closest-corner at 30% 60%, {$theme_options_styles['loginJumbotronRadialBgColor']}, {$theme_options_styles['loginJumbotronBgColor']})"; } if (isset($theme_options_styles['loginImg'])) { $styles_str .= ".jumbotron.jumbotron-login { background-image: url('{$urlThemeData}/{$theme_options_styles['loginImg']}'), {$gradient_str} }"; } if (isset($theme_options_styles['loginImgPlacement']) && $theme_options_styles['loginImgPlacement'] == 'full-width') { $styles_str .= ".jumbotron.jumbotron-login { background-size: cover, cover; background-position: 0% 0%;}"; } //$styles_str .= ".jumbotron.jumbotron-login { background-size: 353px, cover; background-position: 10% 60%;}"; if (isset($theme_options_styles['fluidContainerWidth'])) { $t->set_var('container', 'container-fluid'); $styles_str .= ".container-fluid {max-width:{$theme_options_styles['fluidContainerWidth']}px}"; } if (isset($theme_options_styles['openeclassBanner'])) { $styles_str .= "#openeclass-banner {display: none;}"; } if (!empty($theme_options_styles['leftNavBgColor'])) { $rgba_no_alpha = explode(',', $theme_options_styles['leftNavBgColor']); $rgba_no_alpha[3] = "1)"; $rgba_no_alpha = implode(',', $rgba_no_alpha); $styles_str .= "#background-cheat-leftnav, #bgr-cheat-header, #bgr-cheat-footer{background:{$theme_options_styles['leftNavBgColor']};} @media(max-width: 992px){#leftnav{background:{$rgba_no_alpha};}}"; } if (!empty($theme_options_styles['linkColor'])) { $styles_str .= "a {color: {$theme_options_styles['linkColor']};}"; } if (!empty($theme_options_styles['linkHoverColor'])) { $styles_str .= "a:hover, a:focus {color: {$theme_options_styles['linkHoverColor']};}"; } if (!empty($theme_options_styles['leftSubMenuFontColor'])) { $styles_str .= "#leftnav .panel a {color: {$theme_options_styles['leftSubMenuFontColor']};}"; } if (!empty($theme_options_styles['leftSubMenuHoverBgColor'])) { $styles_str .= "#leftnav .panel a.list-group-item:hover{background: {$theme_options_styles['leftSubMenuHoverBgColor']};}"; } if (!empty($theme_options_styles['leftSubMenuHoverFontColor'])) { $styles_str .= "#leftnav .panel a.list-group-item:hover{color: {$theme_options_styles['leftSubMenuHoverFontColor']};}"; } if (!empty($theme_options_styles['leftMenuFontColor'])) { $styles_str .= "#leftnav .panel a.parent-menu{color: {$theme_options_styles['leftMenuFontColor']};}"; } if (!empty($theme_options_styles['leftMenuBgColor'])) { $styles_str .= "#leftnav .panel a.parent-menu{background: {$theme_options_styles['leftMenuBgColor']};}"; } if (!empty($theme_options_styles['leftMenuHoverFontColor'])) { $styles_str .= "#leftnav .panel .panel-heading:hover {color: {$theme_options_styles['leftMenuHoverFontColor']};}"; } if (!empty($theme_options_styles['leftMenuSelectedFontColor'])) { $styles_str .= "#leftnav .panel a.parent-menu:not(.collapsed){color: {$theme_options_styles['leftMenuSelectedFontColor']};}"; } if (isset($theme_options_styles['imageUpload'])) { $t->set_var('logo_img', "{$urlThemeData}/{$theme_options_styles['imageUpload']}"); } if (isset($theme_options_styles['imageUploadSmall'])) { $t->set_var('logo_img_small', "{$urlThemeData}/{$theme_options_styles['imageUploadSmall']}"); } $t->set_var('EXTRA_CSS', "<style>{$styles_str}</style>"); } $t->set_var('TOOL_PATH', $urlAppend); if (isset($body_action)) { $t->set_var('BODY_ACTION', $body_action); } $t->set_var('LANG_SEARCH', $langSearch); // display role switch button if needed if (isset($require_current_course) and ($is_editor or isset($saved_is_editor) and $saved_is_editor) and !(isset($require_course_admin) and $require_course_admin) and !(isset($require_editor) and $require_editor)) { if ($is_editor) { $t->set_var('STUDENT_VIEW_TITLE', $langStudentViewEnable); } else { $t->set_var('STUDENT_VIEW_TITLE', $langStudentViewDisable); $t->set_var('STUDENT_VIEW_CLASS', 'btn-toggle-on'); } $t->set_var('STUDENT_VIEW_URL', $urlAppend . 'main/student_view.php?course=' . $course_code); } else { if (!$is_embedonce) { $t->set_block('mainBlock', 'statusSwitchBlock', 'delete'); } } // if $require_help is true (set by each tool) display the help link if ($require_help == true) { if (isset($require_current_course) and !$is_editor) { $helpTopic .= '_student'; } $head_content .= "\n <script>\n \$(function() {\n \$('#help-btn').click(function(e) {\n e.preventDefault();\n \$.get(\$(this).attr(\"href\"), function(data) {bootbox.alert(data);});\n });\n });\n </script>\n "; $help_link_icon = "\n\n <a id='help-btn' href=\"" . $urlAppend . "modules/help/help.php?topic={$helpTopic}&language={$language}\">\n <i class='fa fa-question-circle tiny-icon' data-toggle='tooltip' data-placement='top' title='{$langHelp}'></i>\n </a>"; $t->set_var('HELP_LINK_ICON', $help_link_icon); $t->set_var('LANG_HELP', $langHelp); } else { $t->set_var('HELP_LINK_ICON', ''); $t->set_var('LANG_HELP', ''); } if (isset($head_content)) { global $webDir; // required by indexer require_once 'modules/search/indexer.class.php'; if (isset($_SESSION[Indexer::SESSION_PROCESS_AT_NEXT_DRAW]) && $_SESSION[Indexer::SESSION_PROCESS_AT_NEXT_DRAW] === true) { $head_content .= Indexer::queueAsyncJSCode(); $_SESSION[Indexer::SESSION_PROCESS_AT_NEXT_DRAW] = false; } $t->set_var('HEAD_EXTRAS', $head_content); } if (defined('RSS')) { $t->set_var('RSS_LINK_ICON', "\n\n <a href='{$urlAppend}" . RSS . "'>\n <i class='fa fa-rss-square tiny-icon tiny-icon-rss' data-toggle='tooltip' data-placement='top' title='RSS Feed'></i>\n </a>\n\n\n "); } if ($perso_tool_content) { $t->set_var('LANG_MY_PERSO_LESSONS', $langMyCourses); $t->set_var('LANG_MY_PERSO_ANNOUNCEMENTS', $langMyPersoAnnouncements); $t->set_var('LANG_MY_PERSONAL_CALENDAR', $langMyAgenda); $t->set_var('LESSON_CONTENT', $lesson_content); $t->set_var('URL_PATH', $urlAppend); $t->set_var('TOOL_PATH', $urlAppend); $t->set_var('PERSONAL_CALENDAR_CONTENT', $personal_calendar_content); } $t->set_var('COPYRIGHT', 'Open eClass © 2003-' . date('Y')); $t->set_var('TERMS_URL', $urlAppend . 'info/terms.php'); $t->set_var('LANG_TERMS', $langUsageTerms); // Remove tool title block from selected pages if (defined('HIDE_TOOL_TITLE')) { $t->set_block('mainBlock', 'toolTitleBlock', 'toolTitleBlockVar'); $t->set_var('toolTitleBlockVar', ''); } $t->set_var('EXTRA_FOOTER_CONTENT', get_config('extra_footer_content')); // Hack to leave HTML body unclosed if (defined('TEMPLATE_REMOVE_CLOSING_TAGS')) { $t->set_block('mainBlock', 'closingTagsBlock', 'delete'); } // At this point all variables are set and we are ready to send the final output // back to the browser $t->parse('main', 'mainBlock', false); $t->pparse('Output', 'fh'); }
<td width="40"><img src="<?php echo base_url(); ?> /uploads/teams/<?php echo $logo; ?> " alt="<?php echo $team->id; ?> " width="45" height="45" /></td> <td><?php echo $team->name; ?> </td> <td><?php echo ellipsize($team->description, 70); ?> </td> <td class="action"> <a class="action-icon" href="#">Action</a> <ul class="action-list" style="display: none;"> <li><a class="confirm-delete" href="<?php echo site_url('admin/teams/delete/' . $team->id); ?> "><i class="icon-trash icon-large"></i></a></li> <li><a href="<?php echo site_url('admin/teams/edit/' . $team->id); ?> "><i class="icon-edit icon-large"></i></a></li> </ul> </td>
<div class="table-responsive"> <div role="grid" class="dataTables_wrapper form-inline" id="dataTables-example_wrapper"> <table id="youaudit_package" class="table table-striped table-bordered table-hover" width="100%" cellspacing="0"> <thead> <tr> <th>Package name</th> <th>Number Of Asset</th> <th>Enable Package</th> <th>Actions</th> </tr> </thead> <tbody id="Master_Customer_body"> <?php foreach ($packages as $package) { ?> <tr> <td><?php echo ellipsize($package->name, 50); ?></td> <td><?php echo $package->item_limit; ?></td> <td><?php if ($package->enable == 1) { echo 'Yes'; } else { echo 'No'; } ?></td> <td><span class="action-w"><a data-toggle="modal" id="edit_adminuser_id_<?php echo $package->id; ?>" href="#edit_package" title="Edit" data_packagename="<?php echo $package->name; ?>" data_itemlimit="<?php echo $package->item_limit; ?>" data_enable="<?php echo $package->enable; ?>" data_adminuser_id="<?php echo $package->id; ?>" class="edit"><i class="glyphicon glyphicon-edit franchises-i"></i></a>Edit</span></td> </tr> <?php } ?> </tbody> </table> </div> <!-- /.table-responsive -->
/** * Load ellipsize through this helper so it can * be accessed in widgets twig parser. Need to find * a better way to do this! * @param string $string String to be shortened * @param int $length * @return string */ function helper_ellip($string, $length) { $CI =& get_instance(); $CI->load->helper('text'); return ellipsize($string, $length); }
"><?php echo ellipsize($history->new, 50, 0.4); ?> </a></td> </tr> <?php } ?> <?php } ?> <tr> <td><?php echo date('d-M-Y H:i:s', mysql_to_unix($url->created_date)); ?> </td> <td>URL first seen</td> <td><a href="<?php echo $url->url; ?> " title="<?php echo $url->url; ?> "><?php echo ellipsize($url->url, 50, 0.4); ?> </a></td> </tr> </tbody> </table>
<?php foreach ($aGroupAndQuestions['questions'] as $aQuestion) { ?> <li id='list_q<?php echo $aQuestion['qid']; ?> ' class='well well-sm no-nest' data-level='question'><div> <b><a href='<?php echo Yii::app()->getController()->createUrl('admin/questions/sa/editquestion/surveyid/' . $surveyid . '/gid/' . $aQuestion['gid'] . '/qid/' . $aQuestion['qid']); ?> '><?php echo $aQuestion['title']; ?> </a></b>: <?php echo ellipsize($aQuestion['question'], 80); ?> </div></li> <?php } ?> </ol> <?php } ?> </li> <?php } ?> </ol> </div>
<div class="panel-body"> <div class="table-responsive"> <div role="grid" class="dataTables_wrapper form-inline" id="dataTables-example_wrapper"> <table id="User_sites" class="table table-bordered" width="100%" cellspacing="0"> <thead> <tr> <th>Site/Building Name</th> <th>Actions</th> </tr> </thead> <tbody id="Master_Customer_body"> <?php foreach ($sites as $site) { ?> <tr> <td><?php echo ellipsize($site->name, 50); ?></td> <?php if ($site->active == 1) { $access_icon = '<span class="action-w"><a id="disableuser_id_' . $site->id . '" href="' . base_url('admin_section/disableSite/' . $site->id) . '" data_adminuser_id=' . $site->id . ' title="Disable" class="disableadminuser"><i class="fa fa-pause franchises-i"></i></a>Disable</span>'; } else { $access_icon = '<span class="action-w"><a id="enableuser_id_' . $site->id . '" href="' . base_url('admin_section/enableSite/' . $site->id) . '" data_adminuser_id=' . $site->id . ' title="enable" class="enableadminuser"><i class="fa fa-play franchises-i"></i></a>Enable</span>'; } ?> <td><span class="action-w"><a data-toggle="modal" id="edit_adminuser_id_<?php echo $site->id; ?>" href="#edit_site" title="Edit" data_sitename="<?php echo $site->name; ?>" data_adminuser_id="<?php echo $site->id; ?>" class="edit"><i class="glyphicon glyphicon-edit franchises-i"></i></a>Edit</span><?php echo $access_icon; ?><span class="action-w"><a href="javascript:void(0)" data-toggle="modal" onclick="deleteTemplate(this)" data-href="<?php echo base_url('admin_section/archiveSite/' . $site->id); ?>" title="Archive"><i class="glyphicon glyphicon-remove-sign franchises-i"></i></a>Archive</span></td> </tr> <?php } ?> </tbody> </table> </div> <!-- /.table-responsive --> </div>
<div class='col-sm-4'> <select class='form-control' name='targetquestion' id='targetquestion' size='1'> <option value=''><?php eT('(No target question)'); ?> </option> <?php foreach ($questions as $question) { ?> <option value='<?php echo $question['qid'] . '-' . $question['sqid']; ?> '><?php echo $question['title'] . ': ' . ellipsize(flattenText($question['question'], true, true), 43, 0.7); if ($question['sqquestion'] != '') { echo ' - ' . ellipsize(flattenText($question['sqquestion'], true, true), 30, 0.75); } ?> </option> <?php } ?> </select> </div> </div> <div class='form-group'> <div class='col-sm-12 text-center'> <button class='btn btn-success' id='btnSaveParams'> <span class="glyphicon glyphicon-ok"></span> <?php eT('Save'); ?>
echo getLanguageNameFromCode($tmp_lang, false); ?> </a></li> <?php } ?> </ul></div> <?php } ?> <div class='menubar-title ui-widget-header'> <strong><?php $clang->eT("Question"); ?> </strong> <span class='basic'><?php echo ellipsize(FlattenText($qrrow['question']), 200); ?> (<?php echo $clang->gT("ID") . ":" . $qid; ?> )</span> </div> <div class='menubar-main'> <div class='menubar-left'> <img id='separator16' src='<?php echo $sImageURL; ?> separator.gif' class='separator' alt='' /> <?php if (hasSurveyPermission($surveyid, 'surveycontent', 'read')) { if (count(Survey::model()->findByPk($surveyid)->additionalLanguages) == 0) {
/** * Merge Comment Data * * This is a...productive method. * * This method loops through the array of 50 comment db objects and * adds in a few more vars that will be used in the view. Additionally, * we alter some values such as status to make it human readable to get * that logic out of the views where it has no bidness. * * @param array array of comment objects * @param object db result from channel query * @param object db result from authors query * @return array array of altered comment objects */ protected function _merge_comment_data($comments, $channels, $authors) { ee()->load->library('typography'); $config = array('parse_images' => FALSE, 'allow_headings' => FALSE, 'word_censor' => ee()->config->item('comment_word_censoring') == 'y' ? TRUE : FALSE); ee()->typography->initialize($config); // There a result for authors here, or are they all anon? $authors = !$authors->num_rows() ? array() : $authors->result(); foreach ($comments as &$comment) { // Drop the entry title into the comment object foreach ($channels->result() as $row) { if ($comment->entry_id == $row->entry_id) { $comment->entry_title = $row->title; break; } } // Get member info as well. foreach ($authors as $row) { if ($comment->author_id == $row->member_id) { $comment->author_screen_name = $row->screen_name; break; } } if (!isset($comment->author_screen_name)) { $comment->author_screen_name = ''; } // Convert stati to human readable form switch ($comment->status) { case 'o': $comment->status = lang('open'); break; case 'c': $comment->status = lang('closed'); break; default: $comment->status = lang("pending"); } // Add the expand arrow $comment->_expand = array('data' => '<img src="' . ee()->cp->cp_theme_url . 'images/field_collapse.png" alt="' . lang('expand') . '" />', 'class' => 'expand'); // Add the toggle checkbox $comment->_check = form_checkbox('toggle[]', $comment->comment_id, FALSE, 'class="comment_toggle"'); // Alter the email var $comment->email = mailto($comment->email, '', 'class="less_important_link"'); $comment->comment_date = ee()->localize->human_time($comment->comment_date); // Create comment_edit_link $comment->comment_edit_link = sprintf("<a class=\"less_important_link\" href=\"%s\" title=\"%s\">%s</a>", $this->base_url . AMP . 'method=edit_comment_form' . AMP . 'comment_id=' . $comment->comment_id, 'edit', ellipsize($comment->comment, 50)); $comment->comment = array('data' => '<div>' . ee()->typography->parse_type($comment->comment) . '</div>', 'colspan' => 7); $comment->details_link = array('data' => anchor(BASE . AMP . 'C=addons_modules' . AMP . 'M=show_module_cp' . AMP . 'module=comment' . AMP . 'method=edit_comment_form' . AMP . 'comment_id=' . $comment->comment_id, 'EDIT', 'class="submit"'), 'colspan' => 2); } return $comments; }
foreach ($e as $email) { ?> <tr> <td> <?php echo $email['fname'] . ' ' . $email['lname'] . ' ' . $email['mname']; ?> </td> <td> <?php echo $email['email']; ?> </td> <td> <?php echo ellipsize($email['password'], 30); ?> </td> <td> <a href="/delete_email/<?php echo $email['id']; ?> " onclick="return confirm('Are you sure to delete ?')" class="btn btn-danger btn-block btn-sm">Delete</a> </td> </tr> <?php } ?> </table> </div> </div>
function getUrlParamsJSON($iSurveyID) { $iSurveyID = (int) $iSurveyID; $sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language; $sQuery = "select '' as act, up.*,q.title, sq.title as sqtitle, q.question, sq.question as sqquestion from {{survey_url_parameters}} up\n left join {{questions}} q on q.qid=up.targetqid\n left join {{questions}} sq on sq.qid=up.targetsqid\n where up.sid={$iSurveyID} and (q.language='{$sBaseLanguage}' or q.language is null) and (sq.language='{$sBaseLanguage}' or sq.language is null)"; $oResult = Yii::app()->db->createCommand($sQuery)->queryAll(); $i = 0; $aData = new stdClass(); foreach ($oResult as $oRow) { $aData->rows[$i]['id'] = $oRow['id']; if (!is_null($oRow['question'])) { $oRow['title'] .= ': ' . ellipsize(flattenText($oRow['question'], false, true), 43, 0.7); } else { $oRow['title'] = gT('(No target question)'); } if ($oRow['sqquestion'] != '') { $oRow['title'] .= ' - ' . ellipsize(flattenText($oRow['sqquestion'], false, true), 30, 0.75); } unset($oRow['sqquestion']); unset($oRow['sqtitle']); unset($oRow['question']); $aData->rows[$i]['cell'] = array_values($oRow); $i++; } $aData->page = 1; $aData->records = count($oResult); $aData->total = 1; echo ls_json_encode($aData); }
<tr class="gradeA"> <td><span><a href="<?php echo site_url('administration/contents/edit/' . $rep->id . '/' . $rep->div); ?> "><?php echo $rep->div; ?> </a></span></td> <td><span<?php echo strlen($page->uri) > $l ? ' class="tipW" title="' . $page->uri . '"' : ""; ?> ><a href="<?php echo site_url($page->uri); ?> " class="highlightLink"><?php echo ellipsize($page->uri, $l, 0.5); ?> </a></span><span style="display: none;"><?php echo $page->uri; ?> </span></td> <td class="center"><?php echo empty($rep->updated) ? "—" : '<span class="tipN" title="' . date(Setting::value('datetime_format', 'F j, Y @ H:i'), $rep->updated) . '">' . relative_time($rep->updated) . '</span> ' . __('by %s', User::factory($rep->editor_id)->name); ?> </td> <td class="center"><?php $fnd = $rep->repeatableitem->get()->result_count(); echo $fnd; ?> item<?php echo $fnd != 1 ? 's' : '';
/** * Processes one string by adding text helper attributes * * @param FTL_Binding $tag * @param String $value * * @usage <ion:content /> * */ public function process_string(FTL_Binding $tag, $value) { // paragraph & words limit ? $paragraph = $tag->getAttribute('paragraph'); $words = $tag->getAttribute('words'); $chars = $tag->getAttribute('characters'); $ellipsize = $tag->getAttribute('ellipsize'); // Limit to x paragraph if the attribute is set if (!is_null($paragraph)) { $value = tag_limiter($value, 'p', intval($paragraph)); } // Limit to x words if (!is_null($words)) { $value = word_limiter($value, $words); } // Limit to x characters if (!is_null($chars)) { $value = character_limiter($value, $chars); } // Ellipsize the text // See : http://codeigniter.com/user_guide/helpers/text_helper.html if (!is_null($ellipsize)) { $ellipsize = explode(',', $ellipsize); if (!isset($ellipsize[0])) { $ellipsize[0] = 32; } if (!isset($ellipsize[1])) { $ellipsize[1] = 0.5; } if (floatval($ellipsize[1]) > 0.99) { $ellipsize[1] = 0.99; } $value = ellipsize($value, intval($ellipsize[0]), floatval($ellipsize[1])); } return $value; }
/** * Inserts new event and logs the action * @param string $title event title * @param text $content event description * @param string $start event start date time as "yyyy-mm-dd hh:mm:ss" * @param string $duration as "hhh:mm:ss" * @param array $recursion event recursion period as array('unit'=>'D|W|M', 'repeat'=>number to multiply time unit, 'end'=>'YYYY-mm-dd') * @return int $eventid which is the id of the new event */ function add_event($title, $content, $start, $duration, $recursion = NULL){ global $course_id, $langNotValidInput, $is_admin, $is_editor, $langNotAllowed; $eventids = array(); // insert $period = ""; $enddate = null; $multiple_events = false; $d1 = DateTime::createFromFormat('d-m-Y H:i', $start); $d2 = DateTime::createFromFormat('d-m-Y H:i:s', $start); $title = trim($title); if(empty($title) || !(($d1 && $d1->format('d-m-Y H:i') == $start) || ($d2 && $d2->format('d-m-Y H:i:s') == $start))) { return array('success'=>false, 'message'=>$langNotValidInput); } else { $startdate = $d1->format('Y-m-d H:i'); } if(!empty($recursion)) { $period = "P".$recursion['repeat'].$recursion['unit']; $enddate = $recursion['end']; $d1 = DateTime::createFromFormat('d-m-Y', $enddate); if(!($d1 && $d1->format('d-m-Y') == $enddate)){ return array('success'=>false, 'message'=>$langNotValidInput); } else { $enddate = $d1->format('Y-m-d H:i'); } } if (!preg_match('/[0-9]+(:[0-9]+){0,2}/', $duration)) { $duration = '0:00'; } if($is_editor || $is_admin){ $eventid = Database::get()->query("INSERT INTO agenda " . "SET content = ?s, title = ?s, course_id = ?d, start = ?t, duration = ?t, " . "recursion_period = ?s, recursion_end = ?t, visible = 1", purify($content), $title, $course_id, $startdate, $duration, $period, $enddate)->lastInsertID; if(isset($eventid) && !is_null($eventid)){ Database::get()->query("UPDATE agenda SET source_event_id = id WHERE id = ?d",$eventid); $eventids[] = $eventid; } $txt_content = ellipsize(canonicalize_whitespace(strip_tags($content)), 50, '+'); /* Additional events generated by recursion */ if(isset($eventid) && !is_null($eventid) && !empty($recursion)){ $sourceevent = $eventid; $interval = new DateInterval($period); $startdatetime = new DateTime($startdate); $enddatetime = new DateTime($recursion['end']." 23:59:59"); $newdate = date_add($startdatetime, $interval); while($newdate <= $enddatetime) { $multiple_events = true; $neweventid = Database::get()->query("INSERT INTO agenda " . "SET content = ?s, title = ?s, course_id = ?d, start = ?t, duration = ?t, " . "recursion_period = ?s, recursion_end = ?t, " . "source_event_id = ?d, visible = 1", purify($content), $title, $course_id, $newdate->format('Y-m-d H:i'), $duration, $period, $enddate, $sourceevent)->lastInsertID; $newdate = date_add($startdatetime, $interval); $eventids[] = $neweventid; } if(!$multiple_events){ Database::get()->query("UPDATE agenda SET recursion_period = NULL, recursion_end = NULL WHERE id = ?d",$eventid); } Log::record($course_id, MODULE_ID_AGENDA, LOG_INSERT, array('id' => $eventid, 'date' => $start, 'duration' => $duration, 'title' => $title, 'content' => $txt_content)); } return array('success'=>true, 'message'=>'', 'event'=>$eventids); } else { return array('success'=>false, 'message'=>$langNotAllowed); } }
<?php $aReplacementData=array(); ?> <div class='menubar-title ui-widget-header'> <strong><?php eT("Question"); ?></strong> <span class='basic'><?php echo ellipsize(FlattenText($qrrow['question']),200); ?> (<?php echo gT("ID").":".$qid; ?>)</span> </div> <div class='menubar-main'> <div class='menubar-left'> <img id='separator16' src='<?php echo $sImageURL; ?>separator.gif' class='separator' alt='' /> <?php if(Permission::model()->hasSurveyPermission($surveyid,'surveycontent','read')) { ?> <a accesskey='q' id='questionpreviewlink' ' href="<?php echo $this->createUrl("survey/index/action/previewquestion/sid/" . $surveyid . "/gid/" . $gid . "/qid/" . $qid); ?>" target="_blank"> <img src='<?php echo $sImageURL; ?>preview.png' alt='<?php eT("Preview this question"); ?>' /></a> <?php if (count($languagelist) > 1) { ?> <div class="popuptip" rel="questionpreviewlink"><?php eT("Preview this question in:"); ?> <ul> <?php foreach ($languagelist as $tmp_lang){ ?> <li><a target='_blank' href='<?php echo $this->createUrl("survey/index/action/previewquestion/sid/" . $surveyid . "/gid/" . $gid . "/qid/" . $qid . "/lang/" . $tmp_lang); ?>' ><?php echo getLanguageNameFromCode($tmp_lang,false); ?></a></li> <?php } ?> </ul> </div> <?php } ?> <img src='<?php echo $sImageURL; ?>separator.gif' class='separator' alt='' /> <?php } ?> <?php if(Permission::model()->hasSurveyPermission($surveyid,'surveycontent','update')) { ?>
"><?php echo $url->lgsl; ?> </a></td> <td><?php echo $url->interaction_short . ' (' . $url->lgil . ')'; ?> </td> <td><a href="<?php echo $url->url; ?> " title="<?php echo $url->url; ?> "><?php echo ellipsize($url->url, 35, 0.4); ?> </a></td> <td> <?php if ($url->http_status != 200) { ?> <span class="label label-important">Is <?php echo $url->http_status; ?> </span> <?php } elseif ($url->content_looks_like != 200) { ?> <span class="label label-warning">Looks like <?php echo $url->content_looks_like;
if ($bHaveToken) { $aColumns[] = array('header' => 'token', 'name' => 'token', 'type' => 'raw', 'value' => '$data->tokenForGrid'); $aColumns[] = array('header' => gT("First name"), 'name' => 'tokens.firstname', 'id' => 'firstname', 'type' => 'raw', 'value' => '$data->firstNameForGrid', 'filter' => TbHtml::textField('SurveyDynamic[firstname_filter]', $model->firstname_filter)); $aColumns[] = array('header' => gT("Last name"), 'name' => 'tokens.lastname', 'type' => 'raw', 'id' => 'lastname', 'value' => '$data->lastNameForGrid', 'filter' => TbHtml::textField('SurveyDynamic[lastname_filter]', $model->lastname_filter)); $aColumns[] = array('header' => gT("Email"), 'name' => 'tokens.email', 'id' => 'email', 'filter' => TbHtml::textField('SurveyDynamic[email_filter]', $model->email_filter)); } $aColumns[] = array('header' => 'startlanguage', 'name' => 'startlanguage'); // The column model must be built dynamically, since the columns will differ from survey to survey, depending on the questions. // All other columns are based on the questions. // An array to control unicity of $code (EM code) foreach ($model->metaData->columns as $column) { if (!in_array($column->name, $aDefaultColumns)) { $colName = viewHelper::getFieldCode($fieldmap[$column->name], array('LEMcompat' => true)); // This must be unique ...... $base64jsonFieldMap = base64_encode(json_encode($fieldmap[$column->name])); $aColumns[] = array('header' => '<span data-toggle="tooltip" data-placement="bottom" title="' . quoteText(strip_tags($fieldmap[$column->name]['question'])) . '">' . $colName . ' <br/> ' . ellipsize($fieldmap[$column->name]['question'], $model->ellipsize_header_value) . '</span>', 'headerHtmlOptions' => array('style' => 'min-width: 350px;'), 'name' => $column->name, 'type' => 'raw', 'value' => '$data->getExtendedData("' . $column->name . '", "' . $language . '", "' . $base64jsonFieldMap . '")'); } } $this->widget('bootstrap.widgets.TbGridView', array('dataProvider' => $model->search(), 'filter' => $model, 'columns' => $aColumns, 'itemsCssClass' => 'table-striped', 'id' => 'responses-grid', 'ajaxUpdate' => true, 'ajaxType' => 'POST', 'afterAjaxUpdate' => 'bindScrollWrapper', 'template' => "{items}\n<div id='ListPager'><div class=\"col-sm-4\" id=\"massive-action-container\">{$massiveAction}</div><div class=\"col-sm-4 pager-container \">{pager}</div><div class=\"col-sm-4 summary-container\">{summary}</div></div>", 'summaryText' => gT('Displaying {start}-{end} of {count} result(s).') . ' ' . sprintf(gT('%s rows per page'), CHtml::dropDownList('pageSize', $pageSize, Yii::app()->params['pageSizeOptions'], array('class' => 'changePageSize form-control', 'style' => 'display: inline; width: auto'))))); ?> </div> <!-- To update rows per page via ajax --> <script type="text/javascript"> jQuery(function($) { jQuery(document).on("change", '#pageSize', function(){ $.fn.yiiGridView.update('responses-grid',{ data:{ pageSize: $(this).val() }}); }); }); </script> </div>