private static function _createEmptyProject($languageCode, $languageName, $userId)
 {
     $website = Website::get();
     $projectCode = SemDomTransProjectModel::projectCode($languageCode);
     $projectName = SemDomTransProjectModel::projectName($languageCode, $languageName);
     $projectID = ProjectCommands::createProject($projectName, $projectCode, LfProjectModel::SEMDOMTRANS_APP, $userId, $website);
     $project = new SemDomTransProjectModel($projectID);
     $project->languageIsoCode = $languageCode;
     $project->isSourceLanguage = false;
     $project->semdomVersion = SemDomTransProjectModel::SEMDOM_VERSION;
     // by default all created projects have English as their source.  A future feature would allow creating projects off of other source languages
     $englishProject = SemDomTransProjectModel::getEnglishProject();
     $project->sourceLanguageProjectId->id = $englishProject->id->asString();
     return $project->write();
 }
 /**
  * Creates a semdomtrans project and prefills it (using Google Translate data if appropriate flag is set)
  * @param string $languageCode
  * @param string $languageName
  * @param bool $useGoogleTranslateData
  * @param string $userId
  * @param Website $website
  * @param int $semdomVersion
  * @return string
  */
 public static function createProject($languageCode, $languageName, $useGoogleTranslateData, $userId, $website, $semdomVersion = SemDomTransProjectModel::SEMDOM_VERSION)
 {
     $projectCode = SemDomTransProjectModel::projectCode($languageCode, $semdomVersion);
     $projectName = SemDomTransProjectModel::projectName($languageCode, $languageName, $semdomVersion);
     $projectID = ProjectCommands::createProject($projectName, $projectCode, LfProjectModel::SEMDOMTRANS_APP, $userId, $website);
     $project = new SemDomTransProjectModel($projectID);
     $project->languageIsoCode = $languageCode;
     $project->isSourceLanguage = false;
     $project->semdomVersion = $semdomVersion;
     $project->languageName = $languageName;
     // by default all created projects have English as their source.  A future feature would allow creating projects off of other source languages
     $englishProject = SemDomTransProjectModel::getEnglishProject($semdomVersion);
     $project->sourceLanguageProjectId->id = $englishProject->id->asString();
     // prefill project with semdom items
     $project->preFillFromSourceLanguage($useGoogleTranslateData);
     return $project->write();
 }
 public function cleanPreviousProject($languageCode)
 {
     $p = new SemDomTransProjectModel();
     $p->readByCode($languageCode, self::TESTVERSION);
     if (!Id::isEmpty($p->id)) {
         $this->cleanProjectEnvironment($p);
     } else {
         // create the project and then clean the project environment
         $p = new SemDomTransProjectModel();
         $p->projectCode = SemDomTransProjectModel::projectCode($languageCode, self::TESTVERSION);
         $p->write();
         $this->cleanProjectEnvironment($p);
     }
     $p->remove();
 }