当前位置: 首页>>代码示例>>PHP>>正文


PHP ProjectManager::getProjectStructure方法代码示例

本文整理汇总了PHP中ProjectManager::getProjectStructure方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectManager::getProjectStructure方法的具体用法?PHP ProjectManager::getProjectStructure怎么用?PHP ProjectManager::getProjectStructure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProjectManager的用法示例。


在下文中一共展示了ProjectManager::getProjectStructure方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doAction

 public function doAction()
 {
     $this->project_data = getProjectJobData($this->project_id);
     try {
         if (empty($this->project_data)) {
             throw new Exception("No Project Found.", -1);
         }
         $pManager = new ProjectManager();
         $pStruct = $pManager->getProjectStructure();
         switch ($this->exec) {
             case 'merge':
                 $this->checkMergeAccess();
                 $pStruct['job_to_merge'] = $this->job_id;
                 $pManager->mergeALL($pStruct);
                 break;
             case 'check':
                 $this->checkSplitAccess();
                 $pStruct['job_to_split'] = $this->job_id;
                 $pStruct['job_to_split_pass'] = $this->job_pass;
                 $pManager->getSplitData($pStruct, $this->num_split, $this->split_values);
                 break;
             case 'apply':
                 $this->checkSplitAccess();
                 $pStruct['job_to_split'] = $this->job_id;
                 $pStruct['job_to_split_pass'] = $this->job_pass;
                 $pManager->getSplitData($pStruct, $this->num_split, $this->split_values);
                 $pManager->applySplit($pStruct);
                 break;
         }
         $this->result["data"] = $pStruct['split_result'];
     } catch (Exception $e) {
         $this->result['errors'][] = array("code" => $e->getCode(), "message" => $e->getMessage());
     }
 }
开发者ID:indynagpal,项目名称:MateCat,代码行数:34,代码来源:splitJobController.php

示例2: doAction

 public function doAction()
 {
     //check for errors. If there are, stop execution and return errors.
     if (count(@$this->result['errors'])) {
         return false;
     }
     $arFiles = explode('@@SEP@@', html_entity_decode($this->file_name, ENT_QUOTES, 'UTF-8'));
     $default_project_name = $arFiles[0];
     if (count($arFiles) > 1) {
         $default_project_name = "MATECAT_PROJ-" . date("Ymdhi");
     }
     if (empty($this->project_name)) {
         $this->project_name = $default_project_name;
     }
     $sourceLangHistory = $_COOKIE["sourceLang"];
     $targetLangHistory = $_COOKIE["targetLang"];
     // SET SOURCE COOKIE
     if ($sourceLangHistory == '_EMPTY_') {
         $sourceLangHistory = "";
     }
     $sourceLangAr = explode('||', urldecode($sourceLangHistory));
     if (($key = array_search($this->source_language, $sourceLangAr)) !== false) {
         unset($sourceLangAr[$key]);
     }
     array_unshift($sourceLangAr, $this->source_language);
     if ($sourceLangAr == '_EMPTY_') {
         $sourceLangAr = "";
     }
     $newCookieVal = "";
     $sourceLangAr = array_slice($sourceLangAr, 0, 3);
     $sourceLangAr = array_reverse($sourceLangAr);
     foreach ($sourceLangAr as $key => $link) {
         if ($sourceLangAr[$key] == '') {
             unset($sourceLangAr[$key]);
         }
     }
     foreach ($sourceLangAr as $lang) {
         if ($lang != "") {
             $newCookieVal = $lang . "||" . $newCookieVal;
         }
     }
     setcookie("sourceLang", $newCookieVal, time() + 86400 * 365);
     // SET TARGET COOKIE
     if ($targetLangHistory == '_EMPTY_') {
         $targetLangHistory = "";
     }
     $targetLangAr = explode('||', urldecode($targetLangHistory));
     if (($key = array_search($this->target_language, $targetLangAr)) !== false) {
         unset($targetLangAr[$key]);
     }
     array_unshift($targetLangAr, $this->target_language);
     if ($targetLangAr == '_EMPTY_') {
         $targetLangAr = "";
     }
     $newCookieVal = "";
     $targetLangAr = array_slice($targetLangAr, 0, 3);
     $targetLangAr = array_reverse($targetLangAr);
     foreach ($targetLangAr as $key => $link) {
         if ($targetLangAr[$key] == '') {
             unset($targetLangAr[$key]);
         }
     }
     foreach ($targetLangAr as $lang) {
         if ($lang != "") {
             $newCookieVal = $lang . "||" . $newCookieVal;
         }
     }
     setcookie("targetLang", $newCookieVal, time() + 86400 * 365);
     $projectManager = new ProjectManager();
     $projectStructure = $projectManager->getProjectStructure();
     $projectStructure['project_name'] = $this->project_name;
     $projectStructure['result'] = $this->result;
     $projectStructure['private_tm_key'] = $this->private_tm_key;
     $projectStructure['private_tm_user'] = $this->private_tm_user;
     $projectStructure['private_tm_pass'] = $this->private_tm_pass;
     $projectStructure['uploadToken'] = $_COOKIE['upload_session'];
     $projectStructure['array_files'] = $arFiles;
     //list of file name
     $projectStructure['source_language'] = $this->source_language;
     $projectStructure['target_language'] = explode(',', $this->target_language);
     $projectStructure['job_subject'] = $this->job_subject;
     $projectStructure['mt_engine'] = $this->mt_engine;
     $projectStructure['tms_engine'] = $this->tms_engine;
     $projectStructure['status'] = Constants_ProjectStatus::STATUS_NOT_READY_FOR_ANALYSIS;
     $projectStructure['lang_detect_files'] = $this->lang_detect_files;
     $projectStructure['skip_lang_validation'] = true;
     $projectStructure['pretranslate_100'] = $this->pretranslate_100;
     if (INIT::$DQF_ENABLED) {
         $projectStructure['dqf_key'] = $this->dqf_key;
     }
     //if user is logged in, set the uid and the userIsLogged flag
     $this->checkLogin(false);
     if ($this->userIsLogged) {
         $projectStructure['userIsLogged'] = true;
         $projectStructure['uid'] = $this->uid;
     }
     $projectManager = new ProjectManager($projectStructure);
     $projectManager->createProject();
     $this->result = $projectStructure['result'];
 }
开发者ID:reysub,项目名称:MateCat,代码行数:100,代码来源:createProjectController.php

示例3: doAction

 public function doAction()
 {
     //check for errors. If there are, stop execution and return errors.
     if (count(@$this->result['errors'])) {
         return false;
     }
     $arFiles = explode('@@SEP@@', html_entity_decode($this->file_name, ENT_QUOTES, 'UTF-8'));
     $default_project_name = $arFiles[0];
     if (count($arFiles) > 1) {
         $default_project_name = "MATECAT_PROJ-" . date("Ymdhi");
     }
     if (empty($this->project_name)) {
         $this->project_name = $default_project_name;
     }
     $sourceLangHistory = $_COOKIE["sourceLang"];
     $targetLangHistory = $_COOKIE["targetLang"];
     // SET SOURCE COOKIE
     if ($sourceLangHistory == '_EMPTY_') {
         $sourceLangHistory = "";
     }
     $sourceLangAr = explode('||', urldecode($sourceLangHistory));
     if (($key = array_search($this->source_language, $sourceLangAr)) !== false) {
         unset($sourceLangAr[$key]);
     }
     array_unshift($sourceLangAr, $this->source_language);
     if ($sourceLangAr == '_EMPTY_') {
         $sourceLangAr = "";
     }
     $newCookieVal = "";
     $sourceLangAr = array_slice($sourceLangAr, 0, 3);
     $sourceLangAr = array_reverse($sourceLangAr);
     foreach ($sourceLangAr as $key => $link) {
         if ($sourceLangAr[$key] == '') {
             unset($sourceLangAr[$key]);
         }
     }
     foreach ($sourceLangAr as $lang) {
         if ($lang != "") {
             $newCookieVal = $lang . "||" . $newCookieVal;
         }
     }
     setcookie("sourceLang", $newCookieVal, time() + 86400 * 365);
     // SET TARGET COOKIE
     if ($targetLangHistory == '_EMPTY_') {
         $targetLangHistory = "";
     }
     $targetLangAr = explode('||', urldecode($targetLangHistory));
     if (($key = array_search($this->target_language, $targetLangAr)) !== false) {
         unset($targetLangAr[$key]);
     }
     array_unshift($targetLangAr, $this->target_language);
     if ($targetLangAr == '_EMPTY_') {
         $targetLangAr = "";
     }
     $newCookieVal = "";
     $targetLangAr = array_slice($targetLangAr, 0, 3);
     $targetLangAr = array_reverse($targetLangAr);
     foreach ($targetLangAr as $key => $link) {
         if ($targetLangAr[$key] == '') {
             unset($targetLangAr[$key]);
         }
     }
     foreach ($targetLangAr as $lang) {
         if ($lang != "") {
             $newCookieVal = $lang . "||" . $newCookieVal;
         }
     }
     setcookie("targetLang", $newCookieVal, time() + 86400 * 365);
     //search in fileNames if there's a zip file. If it's present, get filenames and add the instead of the zip file.
     $uploadDir = INIT::$UPLOAD_REPOSITORY . DIRECTORY_SEPARATOR . $_COOKIE['upload_session'];
     $newArFiles = array();
     foreach ($arFiles as $__fName) {
         if ('zip' == FilesStorage::pathinfo_fix($__fName, PATHINFO_EXTENSION)) {
             $fs = new FilesStorage();
             $fs->cacheZipArchive(sha1_file($uploadDir . DIRECTORY_SEPARATOR . $__fName), $uploadDir . DIRECTORY_SEPARATOR . $__fName);
             $linkFiles = scandir($uploadDir);
             //fetch cache links, created by converter, from upload directory
             foreach ($linkFiles as $storedFileName) {
                 //check if file begins with the name of the zip file.
                 // If so, then it was stored in the zip file.
                 if (strpos($storedFileName, $__fName) !== false && substr($storedFileName, 0, strlen($__fName)) == $__fName) {
                     //add file name to the files array
                     $newArFiles[] = $storedFileName;
                 }
             }
         } else {
             //this file was not in a zip. Add it normally
             if (file_exists($uploadDir . DIRECTORY_SEPARATOR . $__fName)) {
                 $newArFiles[] = $__fName;
             }
         }
     }
     $arFiles = $newArFiles;
     $projectManager = new ProjectManager();
     $projectStructure = $projectManager->getProjectStructure();
     $projectStructure['project_name'] = $this->project_name;
     $projectStructure['result'] = $this->result;
     $projectStructure['private_tm_key'] = $this->private_tm_key;
     $projectStructure['private_tm_user'] = $this->private_tm_user;
     $projectStructure['private_tm_pass'] = $this->private_tm_pass;
//.........这里部分代码省略.........
开发者ID:spMohanty,项目名称:MateCat,代码行数:101,代码来源:createProjectController.php

示例4: doAction

 public function doAction()
 {
     $uploadFile = new Upload();
     try {
         $stdResult = $uploadFile->uploadFiles($_FILES);
     } catch (Exception $e) {
         $stdResult = array();
         $this->result = array('errors' => array(array("code" => -1, "message" => $e->getMessage())));
         $this->api_output['message'] = $e->getMessage();
     }
     $arFiles = array();
     foreach ($stdResult as $input_name => $input_value) {
         $arFiles[] = $input_value->name;
     }
     //if fileupload was failed this index ( 0 = does not exists )
     $default_project_name = @$arFiles[0];
     if (count($arFiles) > 1) {
         $default_project_name = "MATECAT_PROJ-" . date("Ymdhi");
     }
     if (empty($this->project_name)) {
         $this->project_name = $default_project_name;
         //'NO_NAME'.$this->create_project_name();
     }
     if (empty($this->source_lang)) {
         $this->api_output['message'] = "Missing source language.";
         $this->result['errors'][] = array("code" => -3, "message" => "Missing source language.");
     }
     if (empty($this->target_lang)) {
         $this->api_output['message'] = "Missing target language.";
         $this->result['errors'][] = array("code" => -4, "message" => "Missing target language.");
     }
     //ONE OR MORE ERRORS OCCURRED : EXITING
     //for now we sent to api output only the LAST error message, but we log all
     if (!empty($this->result['errors'])) {
         $msg = "Error \n\n " . var_export(array_merge($this->result, $_POST), true);
         Log::doLog($msg);
         Utils::sendErrMailReport($msg);
         return -1;
         //exit code
     }
     /* Do conversions here */
     $converter = new ConvertFileWrapper($stdResult);
     $converter->intDir = $uploadFile->getUploadPath();
     $converter->errDir = INIT::$CONVERSIONERRORS_REPOSITORY . DIRECTORY_SEPARATOR . $uploadFile->getDirUploadToken();
     $converter->cookieDir = $uploadFile->getDirUploadToken();
     $converter->source_lang = $this->source_lang;
     $converter->target_lang = $this->target_lang;
     $converter->doAction();
     $status = $converter->checkResult();
     if (!empty($status)) {
         $this->api_output['message'] = 'Project Conversion Failure';
         $this->api_output['debug'] = $status;
         $this->result['errors'] = $status;
         Log::doLog($status);
         return -1;
     }
     /* Do conversions here */
     $projectManager = new ProjectManager();
     $projectStructure = $projectManager->getProjectStructure();
     $projectStructure['project_name'] = $this->project_name;
     $projectStructure['result'] = $this->result;
     $projectStructure['private_tm_key'] = $this->private_tm_key;
     $projectStructure['private_tm_user'] = $this->private_tm_user;
     $projectStructure['private_tm_pass'] = $this->private_tm_pass;
     $projectStructure['uploadToken'] = $uploadFile->getDirUploadToken();
     $projectStructure['array_files'] = $arFiles;
     //list of file name
     $projectStructure['source_language'] = $this->source_lang;
     $projectStructure['target_language'] = explode(',', $this->target_lang);
     $projectStructure['mt_engine'] = $this->mt_engine;
     $projectStructure['tms_engine'] = $this->tms_engine;
     $projectStructure['status'] = Constants_ProjectStatus::STATUS_NOT_READY_FOR_ANALYSIS;
     $projectStructure['skip_lang_validation'] = true;
     $projectManager = new ProjectManager($projectStructure);
     $projectManager->createProject();
     $this->result = $projectStructure['result'];
     if (!empty($projectStructure['result']['errors'])) {
         //errors already logged
         $this->api_output['message'] = 'Project Creation Failure';
         $this->api_output['debug'] = $projectStructure['result']['errors'];
     } else {
         //everything ok
         $this->api_output['status'] = 'OK';
         $this->api_output['message'] = 'Success';
         $this->api_output['id_project'] = $projectStructure['result']['id_project'];
         $this->api_output['project_pass'] = $projectStructure['result']['ppassword'];
     }
 }
开发者ID:reysub,项目名称:MateCat,代码行数:88,代码来源:NewController.php

示例5: doAction


//.........这里部分代码省略.........
             $status = $errors = $converter->checkResult();
             if (count($errors) > 0) {
                 //                    $this->result[ 'errors' ] = array_merge( $this->result[ 'errors' ], $errors );
                 $this->result['code'] = 2;
                 foreach ($errors as $__err) {
                     $brokenFileName = ZipArchiveExtended::getFileName($__err['debug']);
                     if (!isset($this->result['errors'][$brokenFileName])) {
                         $this->result['errors'][$brokenFileName] = array('code' => $__err['code'], 'message' => $__err['message'], 'debug' => $brokenFileName);
                     }
                 }
             }
         } else {
             $conversionHandler->doAction();
             $this->result = $conversionHandler->getResult();
             if ($this->result['code'] > 0) {
                 $this->result = array();
             }
         }
     }
     $status = array_values($status);
     if (!empty($status)) {
         $this->api_output['message'] = 'Project Conversion Failure';
         $this->api_output['debug'] = $status;
         $this->result['errors'] = $status;
         Log::doLog($status);
         return -1;
     }
     /* Do conversions here */
     if (isset($this->result['data']) && !empty($this->result['data'])) {
         foreach ($this->result['data'] as $zipFileName => $zipFiles) {
             $zipFiles = json_decode($zipFiles, true);
             $fileNames = Utils::array_column($zipFiles, 'name');
             $arFiles = array_merge($arFiles, $fileNames);
         }
     }
     $newArFiles = array();
     $linkFiles = scandir($intDir);
     foreach ($arFiles as $__fName) {
         if ('zip' == FilesStorage::pathinfo_fix($__fName, PATHINFO_EXTENSION)) {
             $fs = new FilesStorage();
             $fs->cacheZipArchive(sha1_file($intDir . DIRECTORY_SEPARATOR . $__fName), $intDir . DIRECTORY_SEPARATOR . $__fName);
             $linkFiles = scandir($intDir);
             //fetch cache links, created by converter, from upload directory
             foreach ($linkFiles as $storedFileName) {
                 //check if file begins with the name of the zip file.
                 // If so, then it was stored in the zip file.
                 if (strpos($storedFileName, $__fName) !== false && substr($storedFileName, 0, strlen($__fName)) == $__fName) {
                     //add file name to the files array
                     $newArFiles[] = $storedFileName;
                 }
             }
         } else {
             //this file was not in a zip. Add it normally
             if (file_exists($intDir . DIRECTORY_SEPARATOR . $__fName)) {
                 $newArFiles[] = $__fName;
             }
         }
     }
     $arFiles = $newArFiles;
     $projectManager = new ProjectManager();
     $projectStructure = $projectManager->getProjectStructure();
     $projectStructure['project_name'] = $this->project_name;
     $projectStructure['job_subject'] = $this->subject;
     $projectStructure['result'] = $this->result;
     $projectStructure['private_tm_key'] = $this->private_tm_key;
     $projectStructure['private_tm_user'] = $this->private_tm_user;
     $projectStructure['private_tm_pass'] = $this->private_tm_pass;
     $projectStructure['uploadToken'] = $uploadFile->getDirUploadToken();
     $projectStructure['array_files'] = $arFiles;
     //list of file name
     $projectStructure['source_language'] = $this->source_lang;
     $projectStructure['target_language'] = explode(',', $this->target_lang);
     $projectStructure['mt_engine'] = $this->mt_engine;
     $projectStructure['tms_engine'] = $this->tms_engine;
     $projectStructure['status'] = Constants_ProjectStatus::STATUS_NOT_READY_FOR_ANALYSIS;
     $projectStructure['skip_lang_validation'] = true;
     $projectStructure['owner'] = $this->owner;
     if ($this->current_user != null) {
         $projectStructure['id_customer'] = $this->current_user->getEmail();
     }
     if ($this->current_user != null) {
         $projectStructure['id_customer'] = $this->current_user->getEmail();
     }
     $projectManager = new ProjectManager($projectStructure);
     $projectManager->createProject();
     $this->result = $projectStructure['result'];
     if (!empty($projectStructure['result']['errors'])) {
         //errors already logged
         $this->api_output['message'] = 'Project Creation Failure';
         $this->api_output['debug'] = array_values($projectStructure['result']['errors']);
     } else {
         //everything ok
         $this->api_output['status'] = 'OK';
         $this->api_output['message'] = 'Success';
         $this->api_output['id_project'] = $projectStructure['result']['id_project'];
         $this->api_output['project_pass'] = $projectStructure['result']['ppassword'];
         $this->api_output['new_keys'] = $this->new_keys;
         $this->api_output['analyze_url'] = INIT::$HTTPHOST . "/analyze/" . $projectStructure['project_name'] . "/" . $projectStructure['result']['id_project'] . "-" . $projectStructure['result']['ppassword'];
     }
 }
开发者ID:bcrazvan,项目名称:MateCat,代码行数:101,代码来源:NewController.php

示例6: isset

$job_pass = $argv[2];
$num_split = $argv[3];
$apply_split = isset($argv[4]) && $argv[4] == "--apply";
@INIT::obtain();
include_once INIT::$UTILS_ROOT . '/CatUtils.php';
include_once INIT::$UTILS_ROOT . '/Utils.php';
include_once INIT::$UTILS_ROOT . '/Log.php';
include_once INIT::$MODEL_ROOT . '/queries.php';
ini_set('error_reporting', E_ALL);
$db = Database::obtain(INIT::$DB_SERVER, INIT::$DB_USER, INIT::$DB_PASS, INIT::$DB_DATABASE);
$db->debug = INIT::$DEBUG;
$db->connect();
include INIT::$UTILS_ROOT . '/RecursiveArrayObject.php';
include INIT::$UTILS_ROOT . '/ProjectManager.php';
error_reporting(E_ALL & ~E_DEPRECATED);
$pm = new ProjectManager();
/*
http://matecat.local/translate/ESPANOL_VERY_BIG_2900_segs.sdlxliff/en-US-fr-FR/5294-e01e940bdca8
*/
$pStruct = $pm->getProjectStructure();
$pStruct['job_to_split'] = $job_num;
$pStruct['job_to_split_pass'] = $job_pass;
$pm->getSplitData($pStruct, $num_split);
if ($apply_split) {
    $pm->applySplit($pStruct);
}
var_export(json_encode($pStruct['split_result']));
echo "\n";
echo "\n";
echo "\n";
var_export($pStruct['split_result']->getArrayCopy());
开发者ID:kevinvnloctra,项目名称:MateCat,代码行数:31,代码来源:manualSplitJob.php


注:本文中的ProjectManager::getProjectStructure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。