/** * Load an array of RoleEntityQtypeCustomFieldAuthorization objects, * by ModifiedBy Index(es) * @param integer $intModifiedBy * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query * @return RoleEntityQtypeCustomFieldAuthorization[] */ public static function LoadArrayByModifiedBy($intModifiedBy, $objOptionalClauses = null) { // Call RoleEntityQtypeCustomFieldAuthorization::QueryArray to perform the LoadArrayByModifiedBy query try { return RoleEntityQtypeCustomFieldAuthorization::QueryArray(QQ::Equal(QQN::RoleEntityQtypeCustomFieldAuthorization()->ModifiedBy, $intModifiedBy), $objOptionalClauses); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } }
protected function Form_Create() { if (QApplication::QueryString('intDownloadCsv')) { $this->RenderBegin(false); session_cache_limiter('must-revalidate'); // force a "no cache" effect header("Pragma: hack"); // IE chokes on "no cache", so set to something, anything, else. $ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT"; header($ExpStr); header('Content-Type: text/csv'); header('Content-Disposition: csv; filename=skipped_records.csv'); $file = fopen(sprintf("%s/%s_contact_skipped.csv", __TRACMOR_TMP__, $_SESSION['intUserAccountId']), "r"); ob_end_clean(); while ($row = fgets($file, 1000)) { print $row; @ob_flush(); flush(); } QApplication::$JavaScriptArray = array(); QApplication::$JavaScriptArrayHighPriority = array(); $this->RenderEnd(false); exit; } // Create the Header Menu $this->ctlHeaderMenu_Create(); //$this->ctlShortcutMenu_Create(); $this->pnlMain_Create(); $this->pnlStepOne_Create(); $this->Buttons_Create(); $this->intStep = 1; $this->intSkippedRecordCount = 0; $this->blnImportEnd = true; $this->btnRemoveArray = array(); $this->arrItemCustomField = array(); $this->Labels_Create(); $this->objDatabase = Asset::GetDatabase(); // Load Custom Field foreach (CustomField::LoadArrayByActiveFlagEntity(1, EntityQtype::Contact) as $objCustomField) { $this->arrItemCustomField[$objCustomField->CustomFieldId] = $objCustomField; } $this->blnError = true; $intRoleId = QApplication::$objUserAccount->RoleId; $objRoleEntityQtypeBuiltInAuthorization = RoleEntityQtypeBuiltInAuthorization::LoadByRoleIdEntityQtypeIdAuthorizationId($intRoleId, EntityQtype::Contact, 2); // Check the user have edit permissions if ($objRoleEntityQtypeBuiltInAuthorization && $objRoleEntityQtypeBuiltInAuthorization->AuthorizedFlag) { $this->blnError = false; } if (isset($intCustomFieldIdArray) && count($intCustomFieldIdArray)) { //QApplication::$Database[1]->EnableProfiling(); // Load restrict permisions for Custom Fields $objConditions = QQ::AndCondition(QQ::Equal(QQN::RoleEntityQtypeCustomFieldAuthorization()->RoleId, (string) $intRoleId), QQ::In(QQN::RoleEntityQtypeCustomFieldAuthorization()->EntityQtypeCustomField->CustomFieldId, $intCustomFieldIdArray), QQ::Equal(QQN::RoleEntityQtypeCustomFieldAuthorization()->AuthorizedFlag, false)); $objClauses = array(); array_push($objClauses, QQ::Expand(QQN::RoleEntityQtypeCustomFieldAuthorization()->EntityQtypeCustomField->EntityQtypeCustomFieldId)); array_push($objClauses, QQ::OrderBy(QQN::RoleEntityQtypeCustomFieldAuthorization()->EntityQtypeCustomFieldId)); $arrRoleEntityQtypeCustomFieldAuthorization = RoleEntityQtypeCustomFieldAuthorization::QueryArray($objConditions, $objClauses); if ($arrRoleEntityQtypeCustomFieldAuthorization) { foreach ($arrRoleEntityQtypeCustomFieldAuthorization as $objRoleAuth) { if (array_key_exists($objRoleAuth->EntityQtypeCustomField->CustomFieldId, $this->arrAssetCustomField)) { unset($this->arrAssetCustomField[$objRoleAuth->EntityQtypeCustomField->CustomFieldId]); } } } //QApplication::$Database[1]->OutputProfiling(); } $this->intUserArray = array(); // Load Users foreach (UserAccount::LoadAll() as $objUser) { $this->intUserArray[strtolower($objUser->Username)] = $objUser->UserAccountId; } $this->strAcceptibleMimeArray = array('text/plain' => 'txt', 'text/comma-separated-values' => 'csv', 'text/csv' => 'csv', 'text/x-comma-separated-values' => 'csv', 'application/vnd.ms-excel' => 'csv', 'application/csv' => 'csv', 'text/x-csv' => 'csv'); }
/** * Main utility method to aid with data binding. It is used by the default BindAllRows() databinder but * could and should be used by any custom databind methods that would be used for instances of this * MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause. * * 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). * * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query * @return void */ public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null) { // Setup input parameters to default values if none passed in if (!$objCondition) { $objCondition = QQ::All(); } $objClauses = $objOptionalClauses ? $objOptionalClauses : array(); // We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below if ($this->Paginator) { $this->TotalItemCount = RoleEntityQtypeCustomFieldAuthorization::QueryCount($objCondition, $objClauses); } // 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 RoleEntityQtypeCustomFieldAuthorization, given the clauses above $this->DataSource = RoleEntityQtypeCustomFieldAuthorization::QueryArray($objCondition, $objClauses); }