コード例 #1
0
ファイル: install.php プロジェクト: kisorbiswal/Creamy
 $customersType = "default";
 if (isset($_POST["setup_customers"])) {
     $customersType = $_POST["setup_customers"];
 }
 $success = FALSE;
 // build the array of customers' names
 $customerNames = array();
 array_push($customerNames, "contacts");
 if ($customersType == "default") {
     // default customers schema
     array_push($customerNames, "customers");
 } else {
     if ($customersType == "custom") {
         // custom customers schema
         foreach ($_POST as $key => $value) {
             if (\creamy\CRMUtils::startsWith($key, "customCustomerGroup")) {
                 array_push($customerNames, $value);
             }
         }
     }
 }
 $dbInstaller = new DBInstaller($dbhost, $dbname, $dbuser, $dbpass);
 // setup customers' tables
 if ($dbInstaller->setupCustomerTables($customersType, $customerNames)) {
     // enable customers statistic retrieval
     if ($dbInstaller->setupCustomersStatistics($customersType, $customerNames)) {
         $success = true;
     } else {
         $success = false;
         $error = $lh->translationFor("unable_set_statistics") . ": " . $dbInstaller->error;
     }
コード例 #2
0
 /**
  * Gets an array with all the enabled languages in the CRM in the following form:
  * [ "en_US" => "en_US (american english)", "es_ES" => "es_ES (spanish)", ... ]
  */
 public static function getAvailableLanguages()
 {
     $files = scandir(\creamy\CRMUtils::creamyBaseDirectoryPath(false) . CRM_LANGUAGE_BASE_DIR);
     $result = array();
     $ignoreLocales = array("datatables");
     foreach ($files as $file) {
         if (!is_dir($file) && !\creamy\CRMUtils::startsWith($file, ".") && !in_array($file, $ignoreLocales)) {
             $localeCodeForFile = str_replace("_", "-", $file);
             $languageForLocale = utf8_decode(\Locale::getDisplayLanguage($localeCodeForFile));
             $result[$file] = "{$file} ({$languageForLocale})";
         }
     }
     return $result;
 }
コード例 #3
0
ファイル: UIHandler.php プロジェクト: kisorbiswal/Creamy
 /** 
  * returns the filetype icon for a given file. This filetype can be used added to fa-
  * for the icon representation of a file.	
  */
 public function getFiletypeIconForFile($filename)
 {
     $mimetype = mime_content_type($filename);
     if (\creamy\CRMUtils::startsWith($mimetype, "image/")) {
         return CRM_FILETYPE_IMAGE;
     } else {
         if ($mimetype == "application/pdf") {
             return CRM_FILETYPE_PDF;
         } else {
             if ($mimetype == "application/zip") {
                 return CRM_FILETYPE_ZIP;
             } else {
                 if ($mimetype == "text/plain") {
                     return CRM_FILETYPE_TXT;
                 } else {
                     if ($mimetype == "text/html") {
                         return CRM_FILETYPE_HTML;
                     } else {
                         if (\creamy\CRMUtils::startsWith($mimetype, "video/")) {
                             return CRM_FILETYPE_VIDEO;
                         } else {
                             return CRM_FILETYPE_UNKNOWN;
                         }
                     }
                 }
             }
         }
     }
 }