protected function IsSuggestionUsed($objSuggestion)
 {
     if (NarroContextInfo::QueryCount(QQ::AndCondition(QQ::Equal(QQN::NarroContextInfo()->Context->File->Active, true), QQ::Equal(QQN::NarroContextInfo()->Context->Active, true), QQ::Equal(QQN::NarroContextInfo()->ValidSuggestionId, $objSuggestion->SuggestionId)))) {
         $strLink = NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_APPROVED, "'" . $objSuggestion->Text->TextValue . "'", 0, 1, 30, 0, 0, '');
         $this->lblText->Warning = sprintf(t('This translation was already approved somewhere.<br />If you still want to delete it, click <a href="%s" target="_blank">here</a> to edit all the texts that use it or %s'), $strLink, '');
         return true;
     }
     /**
     elseif ($intVoteCount = NarroSuggestionVote::QueryCount(QQ::AndCondition(QQ::Equal(QQN::NarroSuggestionVote()->SuggestionId, $strSuggestionId), QQ::NotEqual(QQN::NarroSuggestionVote()->UserId, QApplication::GetUserId())))) {
         $this->lblMessage->ForeColor = 'red';
         $this->lblMessage->Text = sprintf(t('You cannot alter this suggestion because it has %d vote(s).'), $intVoteCount);
         $this->MarkAsModified();
         return true;
     }
     */
     return false;
 }
 public function dtrText_Bind($strFormId = null, $strControlId = null, $strParameter = null, $blnReset = false)
 {
     if ($blnReset) {
         $this->dtrText->RemoveChildControls(true);
     }
     $arrClausesWithLimit = $this->arrClauses;
     $arrClausesWithLimit[] = $this->dtrText->LimitClause;
     $this->dtrText->DataSource = NarroContextInfo::QueryArray(QQ::AndCondition($this->arrConditions), $arrClausesWithLimit);
     if ($this->lstProject->SelectedValue) {
         $this->intTotalItemCount = NarroContextInfo::QueryCount(QQ::AndCondition($this->arrConditions), $this->arrClauses);
         $this->dtrText->TotalItemCount = $this->intTotalItemCount;
     } else {
         $this->intTotalItemCount = 0;
     }
     if ($this->blnNewEditorCreated == false) {
         $this->intTotalItemCount = $this->intStart + count($this->dtrText->DataSource);
     }
     if ($this->intStart == 0) {
         $this->btnLess->Display = false;
     }
     if ($this->intTotalItemCount == $this->dtrText->ItemCount) {
         $this->chkLast->Checked = true;
         $this->btnMore->DisplayStyle = QDisplayStyle::None;
     } else {
         $this->chkLast->Checked = false;
     }
     if ($this->strCurrentTranslationId) {
         $txtTranslation = $this->Form->GetControl($this->strCurrentTranslationId);
         if ($txtTranslation instanceof QTextBox) {
             $txtTranslation->Focus();
         }
     }
     $this->chkRequestMoreSent->Checked = false;
 }
 public static function CountByFileName($strFileName, $intFilter, $objExtraCondition = null)
 {
     if (!is_object($objExtraCondition)) {
         $objExtraCondition = QQ::All();
     }
     if (trim($strFileName) == '') {
         $objSearchCondition = QQ::All();
     } elseif (preg_match("/^'.*'\$/", $strFileName)) {
         $objSearchCondition = QQ::Equal(QQN::NarroContextInfo()->Context->File->FileName, substr($strFileName, 1, -1));
     } else {
         $objSearchCondition = QQ::Like(QQN::NarroContextInfo()->Context->File->FileName, '%' . $strFileName . '%');
     }
     switch ($intFilter) {
         case NarroTextListForm::SHOW_UNTRANSLATED_TEXTS:
             $objFilterCondition = QQ::Equal(QQN::NarroContextInfo()->HasSuggestions, 0);
             break;
         case NarroTextListForm::SHOW_APPROVED_TEXTS:
             $objFilterCondition = QQ::IsNotNull(QQN::NarroContextInfo()->ValidSuggestionId);
             break;
         case NarroTextListForm::SHOW_TEXTS_THAT_REQUIRE_APPROVAL:
             $objFilterCondition = QQ::AndCondition(QQ::IsNull(QQN::NarroContextInfo()->ValidSuggestionId), QQ::Equal(QQN::NarroContextInfo()->HasSuggestions, 1));
             break;
         default:
             // no filters
             $objFilterCondition = QQ::All();
     }
     $intContextCount = NarroContextInfo::QueryCount(QQ::AndCondition($objSearchCondition, $objFilterCondition, $objExtraCondition), array(QQ::GroupBy(QQN::NarroContextInfo()->ContextId)));
     return $intContextCount;
 }
 /**
  * Default / simple DataBinder for this Meta DataGrid.  This can easily be overridden
  * by calling SetDataBinder() on this DataGrid with another DataBinder of your choice.
  *
  * If a paginator is set on this DataBinder, it will use it.  If not, then no pagination will be used.
  * It will also perform any sorting (if applicable).
  */
 public function MetaDataBinder()
 {
     $objConditions = $this->Conditions;
     if (null !== $this->conAdditionalConditions) {
         $objConditions = QQ::AndCondition($this->conAdditionalConditions, $objConditions);
     }
     // Setup the $objClauses Array
     $objClauses = array();
     if (null !== $this->clsAdditionalClauses) {
         $objClauses = $this->clsAdditionalClauses;
     }
     // Remember!  We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = NarroContextInfo::QueryCount($objConditions);
     }
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be a Query result from NarroContextInfo, given the clauses above
     $this->DataSource = NarroContextInfo::QueryArray($objConditions, $objClauses);
 }
 /**
  * Count NarroContextInfos
  * by HasSuggestions Index(es)
  * @param boolean $blnHasSuggestions
  * @return int
  */
 public static function CountByHasSuggestions($blnHasSuggestions)
 {
     // Call NarroContextInfo::QueryCount to perform the CountByHasSuggestions query
     return NarroContextInfo::QueryCount(QQ::Equal(QQN::NarroContextInfo()->HasSuggestions, $blnHasSuggestions));
 }