public function GetControlHtml()
 {
     $strLogContents = '';
     foreach (NarroLog::QueryArray(QQ::AndCondition(QQ::Equal(QQN::NarroLog()->ProjectId, $this->intProjectId), QQ::Equal(QQN::NarroLog()->LanguageId, $this->intLanguageId), QQ::GreaterThan(QQN::NarroLog()->Date, $this->dttStart))) as $objLogEntry) {
         switch ($objLogEntry->Priority) {
             case NarroLog::PRIORITY_INFO:
                 $strLogContents .= '<div class="info"';
                 break;
             case NarroLog::PRIORITY_WARN:
                 $strLogContents .= '<div class="warning"';
                 break;
             case NarroLog::PRIORITY_ERROR:
                 $strLogContents .= '<div class="error"';
                 break;
             default:
                 $strLogContents .= '<div';
         }
         $strLogContents .= sprintf('title="%s">%s</div>', $objLogEntry->Date, nl2br(NarroString::HtmlEntities($objLogEntry->Message)));
     }
     $this->strText = sprintf('<div class="ui-accordion ui-widget ui-helper-reset ui-accordion-icons">
             <h3 class="ui-accordion-header ui-helper-reset ui-state-default ui-state-active ui-corner-top">
             <span class="ui-icon ui-icon-triangle-1-s"></span>
             <a>%s</a>
             </h3>
             <div class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active" style="max-height:300px;overflow:auto">
             %s
             </div>
             </div>', t('Operation log'), $strLogContents);
     return parent::GetControlHtml();
 }
 protected function GetControlHtml()
 {
     if ($this->intTotal == 0) {
         $this->strText = t('Nothing to translate');
         return parent::GetControlHtml();
     }
     $intPercentTranslated = 0;
     $intPercentFuzzy = 0;
     $strText = sprintf(sprintf('<div class="graph" title="%s">', t('%d with suggestions, %d approved, %d untranslated, %d in total')), $this->intFuzzy, $this->intTranslated, $this->intTotal - $this->intFuzzy - $this->intTranslated, $this->intTotal);
     if ($this->intTranslated <= $this->intTotal) {
         if ($this->intTranslated > 0) {
             $intPercentTranslated = floor($this->intTranslated * 100 / $this->intTotal);
         } else {
             $intPercentTranslated = 0;
         }
         $strText .= sprintf('<img src="%s" width="%d" height="100%%" border="0" />', 'assets/images/green-bar.png', $intPercentTranslated);
         if ($this->intFuzzy > 0) {
             $intPercentFuzzy = ceil($this->intFuzzy * 100 / $this->intTotal);
         } else {
             $intPercentFuzzy = 0;
         }
         $strText .= sprintf('<img src="%s" width="%d" height="100%%" border="0" />', 'assets/images/orange-bar.png', $intPercentFuzzy);
     }
     if ($this->intTotal > $this->intFuzzy + $this->intTranslated) {
         $intPercentUntranslated = 100 - $intPercentFuzzy - $intPercentTranslated;
     } else {
         $intPercentUntranslated = 0;
     }
     $strText .= sprintf('<img src="%s" width="%d" height="100%%" border="0" />', 'assets/images/red-bar.png', $intPercentUntranslated);
     $strText .= sprintf(' %d%%</div>', $intPercentTranslated);
     $this->strText = $strText;
     return parent::GetControlHtml();
 }
Example #3
0
 public function GetControlHtml()
 {
     $arrData = array();
     $arrToolTip = array();
     $intIndex = 1;
     if ($this->intTotal > 0) {
         $arrData[t('Others')] = 0;
         foreach ($this->arrData as $strLabel => $intCount) {
             if ($intCount > $this->intMinimumDataValue) {
                 if ($intIndex > $this->intMaxValues) {
                     $arrData[t('Others')] += round($intCount * 100 / $this->intTotal, 2);
                     $arrToolTip[t('Others')] = sprintf('%s (%d), ', t('Others'), $arrData[t('Others')]);
                 } else {
                     $arrData[$strLabel] = round($intCount * 100 / $this->intTotal, 2);
                     $arrToolTip[$strLabel] = sprintf('%s (%d)', $strLabel, $intCount);
                 }
                 $intIndex++;
             }
         }
     }
     if (isset($arrData[t('Others')]) && $arrData[t('Others')] == 0) {
         unset($arrData[t('Others')]);
         unset($arrToolTip[t('Others')]);
     }
     if (count($arrData)) {
         $strData = join(',', array_values($arrData));
         $strLabels = join('|', array_keys($arrData));
         $strTooltip = join(',', array_values($arrToolTip));
         $this->strText = sprintf('<img src="http://chart.apis.google.com/chart?cht=p&chd=t:%s&chs=%dx%d&chl=%s&chf=bg,s,65432100" alt="%s" title="%s" />', $strData, $this->strWidth, $this->strHeight, $strLabels, $strTooltip, $strTooltip);
     } else {
         $this->blnDisplay = false;
     }
     return parent::GetControlHtml();
 }
 public function GetControlHtml()
 {
     $this->strText = '';
     if ($this->fileToUpload->Display) {
         $this->strText .= $this->fileToUpload->Render(false);
     }
     if ($this->btnImport->Display) {
         $this->strText .= $this->btnImport->Render(false);
     }
     return parent::GetControlHtml();
 }
 public function GetControlHtml()
 {
     /*			if ($this->objFileAsset) {
     				$this->strCssClass = 'FileAssetPanelItem';
     				$this->SetCustomStyle('background', 'url(' . $this->objFileAsset->ThumbnailUrl() . ') no-repeat');
     			} else {
     				$this->strCssClass = 'FileAssetPanelItemNone';
     				$this->SetCustomStyle('background', null);
     			}*/
     return parent::GetControlHtml();
 }
 public function GetControlHtml()
 {
     $this->strText = $this->pnlMainTab->Render(false);
     return parent::GetControlHtml();
 }
 public function GetControlHtml()
 {
     $this->strText = $this->btnExport->Render(false);
     return parent::GetControlHtml();
 }
Example #8
0
 protected function GetControlHtml()
 {
     $strToReturn = parent::GetControlHtml();
     return $strToReturn;
 }
 public function GetControlHtml()
 {
     $this->strText = $this->pnlTranslationSource->Render(false);
     return parent::GetControlHtml();
 }
Example #10
0
 public function GetControlHtml()
 {
     $strOutput = '<ul class="tabs-nav">';
     foreach ($this->arrTab as $intTabIndex => $objTabSection) {
         if ($this->strFloat == 'right') {
             $strLiCssClass = 'floatright ';
         } else {
             $strLiCssClass = '';
         }
         if (isset($this->arrTabUrl[$intTabIndex])) {
             $strOutput .= sprintf('<li class="%s"><a href="%s"><span>%s</span></a></li>', $strLiCssClass, $this->arrTabUrl[$intTabIndex], $this->arrTabTitle[$intTabIndex]);
         } else {
             $objLink = new QLinkButton($this);
             $objLink->Text = sprintf('<span>%s</span>', $this->arrTabTitle[$intTabIndex]);
             $objLink->HtmlEntities = false;
             $objLink->ActionParameter = $intTabIndex;
             if ($this->blnUseAjax) {
                 $objLink->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'changeTab'));
             } else {
                 $objLink->AddAction(new QClickEvent(), new QServerControlAction($this, 'changeTab'));
             }
             if ($intTabIndex == $this->intSelectedTab) {
                 $strLiCssClass .= 'tabs-selected';
             }
             $strOutput .= sprintf('<li class="%s">%s</li>', $strLiCssClass, $objLink->Render(false));
         }
     }
     $strOutput .= '</ul>';
     foreach ($this->arrTab as $intTabIndex => $objTabSection) {
         if (!$objTabSection->CssClass) {
             $objTabSection->CssClass = 'tabs-container';
         }
         $objTabSection->Display = $this->intSelectedTab == $intTabIndex;
         try {
             $strOutput .= $objTabSection->Render(false);
         } catch (Exception $objEx) {
             throw $objEx;
         }
     }
     $this->strText = $strOutput;
     return parent::GetControlHtml();
 }
 protected function GetControlHtml()
 {
     $strOutput = $this->lblMessage->Render(false) . '<br /><table style="border: 1px solid #DDDDDD" cellpadding="4" cellspacing="0" width="100%">';
     foreach (NarroProject::$AvailablePreferences as $strName => $arrPref) {
         if ($arrPref['project_type'] && $arrPref['project_type'] != $this->objProject->ProjectType) {
             continue;
         }
         $this->lblMessage->Text = t('Here you can set your project preferences.');
         switch ($arrPref['type']) {
             case 'number':
                 $txtNumber = new QIntegerTextBox($this);
                 $txtNumber->Name = $strName;
                 $txtNumber->Minimum = 5;
                 $txtNumber->Maximum = 100;
                 $txtNumber->MaxLength = 3;
                 $txtNumber->Width = 50;
                 if ($arrPref['global']) {
                     $txtNumber->Enabled = QApplication::HasPermission('Can edit project', $this->objProject->ProjectId);
                 }
                 $txtNumber->Text = $this->objProject->GetPreferenceValueByName($strName);
                 $strOutput .= sprintf('<tr class="datagrid_row datagrid_even" style="height:40px"><td>%s:</td><td>%s</td><td style="font-size:-1">%s</td></tr>', t($strName), $txtNumber->RenderWithError(false), $arrPref['description'] ? t($arrPref['description']) : '');
                 $this->arrControls[$strName] = $txtNumber;
                 break;
             case 'text':
                 $txtTextPref = new QTextBox($this);
                 $txtTextPref->Name = $strName;
                 if ($arrPref['global']) {
                     $txtTextPref->Enabled = QApplication::HasPermission('Can edit project', $this->objProject->ProjectId);
                 }
                 $txtTextPref->Text = $this->objProject->GetPreferenceValueByName($strName);
                 $txtTextPref->Columns = strlen($txtTextPref->Text);
                 $strOutput .= sprintf('<tr class="datagrid_row datagrid_even" style="height:40px"><td>%s:</td><td>%s</td><td style="font-size:-1">%s</td></tr>', t($strName), $txtTextPref->RenderWithError(false), $arrPref['description'] ? t($arrPref['description']) : '');
                 $this->arrControls[$strName] = $txtTextPref;
                 break;
             case 'option':
                 $lstOption = new QListBox($this);
                 $lstOption->Name = $strName;
                 if ($arrPref['global']) {
                     $lstOption->Enabled = QApplication::HasPermission('Can edit project', $this->objProject->ProjectId);
                 }
                 foreach ($arrPref['values'] as $strValue) {
                     $lstOption->AddItem(t($strValue), $strValue, $strValue == $this->objProject->GetPreferenceValueByName($strName));
                 }
                 $strOutput .= sprintf('<tr class="datagrid_row datagrid_even" style="height:40px"><td>%s:</td><td>%s</td><td style="font-size:-1">%s</td></tr>', t($strName), $lstOption->RenderWithError(false), $arrPref['description'] ? t($arrPref['description']) : '');
                 $this->arrControls[$strName] = $lstOption;
                 break;
         }
     }
     $strOutput .= '</table><br />';
     $this->strText = $strOutput;
     return parent::GetControlHtml();
 }
Example #12
0
 protected function GetControlHtml()
 {
     $strOutput = $this->lblMessage->Render(false) . '<br /><table style="border: 1px solid #DDDDDD" cellpadding="4" cellspacing="0" width="100%">';
     foreach (NarroUser::$AvailablePreferences as $strName => $arrPref) {
         switch ($arrPref['type']) {
             case 'number':
                 $txtNumber = new QIntegerTextBox($this);
                 $txtNumber->Name = $strName;
                 $txtNumber->Minimum = 5;
                 $txtNumber->Maximum = 100;
                 $txtNumber->MaxLength = 3;
                 $txtNumber->Width = 50;
                 $txtNumber->Text = $this->objUser->GetPreferenceValueByName($strName);
                 $strOutput .= sprintf('<tr class="datagrid_row datagrid_even" style="height:40px"><td>%s:</td><td>%s</td><td style="font-size:-1">%s</td></tr>', t($strName), $txtNumber->RenderWithError(false), t($arrPref['description']));
                 $this->arrControls[$strName] = $txtNumber;
                 break;
             case 'text':
                 $txtTextPref = new QTextBox($this);
                 $txtTextPref->Name = $strName;
                 $txtTextPref->Text = $this->objUser->GetPreferenceValueByName($strName);
                 if ($strName == 'Special characters') {
                     $strSelect = sprintf('<select onchange="document.getElementById(\'%s\').value+=this.options[this.selectedIndex].value;">', $txtTextPref->ControlId);
                     foreach (NarroDiacriticsPanel::$arrEntities as $strEntityName => $strEntityChar) {
                         $strSelect .= sprintf('<option value=" %s">%s (%s)', $strEntityName, $strEntityChar, $strEntityName);
                     }
                     $strSelect .= '</select>';
                     $arrPref['description'] = t($arrPref['description']) . $strSelect;
                     $txtTextPref->Width = 400;
                 } elseif ($strName == 'Other languages') {
                     $strSelect = sprintf('<select onchange="document.getElementById(\'%s\').value+= \' \' + this.options[this.selectedIndex].value;">', $txtTextPref->ControlId);
                     foreach (NarroLanguage::QueryArray(QQ::All(), QQ::Clause(QQ::OrderBy(QQN::NarroLanguage()->LanguageName))) as $objLanguage) {
                         $strSelect .= sprintf('<option value="%s">%s (%s)', $objLanguage->LanguageCode, t($objLanguage->LanguageName), $objLanguage->LanguageCode);
                     }
                     $strSelect .= '</select>';
                     $arrPref['description'] = t($arrPref['description']) . $strSelect;
                     $txtTextPref->Width = 400;
                 }
                 $strOutput .= sprintf('<tr class="datagrid_row datagrid_even" style="height:40px"><td>%s:</td><td>%s</td><td style="font-size:-1">%s</td></tr>', t($strName), $txtTextPref->RenderWithError(false), $arrPref['description']);
                 $this->arrControls[$strName] = $txtTextPref;
                 break;
             case 'option':
                 $lstOption = new QListBox($this);
                 $lstOption->Name = $strName;
                 if ($strName == 'Language') {
                     $arrLanguages = NarroLanguage::LoadAllActive(QQ::Clause(QQ::OrderBy(QQN::NarroLanguage()->LanguageName)));
                     foreach ($arrLanguages as $objLanguage) {
                         $lstOption->AddItem(t($objLanguage->LanguageName), $objLanguage->LanguageCode, $objLanguage->LanguageCode == $this->objUser->GetPreferenceValueByName($strName));
                     }
                 } elseif ($strName == 'Application language') {
                     $arrLanguages = NarroLanguage::QueryArray(QQ::All(), QQ::Clause(QQ::OrderBy(QQN::NarroLanguage()->LanguageName)));
                     foreach ($arrLanguages as $objLanguage) {
                         $lstOption->AddItem(t($objLanguage->LanguageName), $objLanguage->LanguageCode, $objLanguage->LanguageCode == $this->objUser->GetPreferenceValueByName($strName));
                     }
                 } else {
                     foreach ($arrPref['values'] as $strValue) {
                         $lstOption->AddItem(t($strValue), $strValue, $strValue == $this->objUser->GetPreferenceValueByName($strName));
                     }
                 }
                 $strOutput .= sprintf('<tr class="datagrid_row datagrid_even" style="height:40px"><td>%s:</td><td>%s</td><td style="font-size:-1">%s</td></tr>', t($strName), $lstOption->RenderWithError(false), t($arrPref['description']));
                 $this->arrControls[$strName] = $lstOption;
                 break;
         }
     }
     $strOutput .= '</table><br />';
     $strOutput .= $this->btnCancel->Render(false) . ' ' . $this->btnSave->Render(false);
     if ($this->txtPreviousUrl) {
         $strOutput .= ' ' . sprintf(t('Click <a href="%s">here</a> to return to the page you were.'), $this->txtPreviousUrl);
     }
     $this->strText = $strOutput;
     return parent::GetControlHtml();
 }