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


PHP PartKeepr::i18n方法代码示例

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


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

示例1: setPackagingUnit

 /**
  * Sets the packaging unit for a specific distributor.
  * 
  * For example, some distributors only sell resistors in packs of 100, so you can't order just one. We use the
  * packagingUnit to calculate how many pieces will be delivered once ordered. So if your stock level falls below
  * the minimum (example: you would need to order 10 resistors), we suggest that you only order one resistor pack
  * instead of 10.
  *   
  * @param int $packagingUnit The amount of items in one package
  * @throws \PartKeepr\Part\OutOfRangeException When the packaging unit is less than 1
  */
 public function setPackagingUnit($packagingUnit)
 {
     $packagingUnit = intval($packagingUnit);
     if ($packagingUnit < 1) {
         $exception = new OutOfRangeException(PartKeepr::i18n("Packaging Unit is out of range"));
         $exception->setDetail(PartKeepr::i18n("The packaging unit must be 1 or higher"));
         throw $exception;
     }
     $this->packagingUnit = $packagingUnit;
 }
开发者ID:JohnEffland,项目名称:PartKeepr,代码行数:21,代码来源:PartDistributor.php

示例2: uploadCam

 /**
  * Processes data via HTTP POST. Reads php://input and creates a temporary image out of it.
  */
 public function uploadCam()
 {
     $tempFile = tempnam("/tmp", "PWC") . ".jpg";
     $result = file_put_contents($tempFile, file_get_contents('php://input'));
     $image = new TempUploadedFile();
     $image->replace($tempFile);
     $image->setOriginalFilename(sprintf(PartKeepr::i18n("Cam photo of %s"), date("Y-m-d H:i:s")) . ".jpg");
     PartKeepr::getEM()->persist($image);
     PartKeepr::getEM()->flush();
     return array("id" => $image->getId(), "extension" => $image->getExtension(), "size" => $image->getSize(), "originalFilename" => $image->getOriginalFilename());
 }
开发者ID:JohnEffland,项目名称:PartKeepr,代码行数:14,代码来源:TempFileService.php

示例3: decode

 /**
  * Method decodes the incoming string and returns the JSON decoded array if
  * everything was fine. If a syntax error was detected, it throws an exception.
  * 
  * @param string $string
  * @throws InvalidArgumentException
  */
 public static function decode($string)
 {
     $jsonDecoded = json_decode(trim($string), true);
     if ($jsonDecoded === null) {
         if (strlen($string) == 0) {
             $jsonDecoded = array();
         } else {
             throw new InvalidArgumentException(PartKeepr::i18n('Extended rendering configuration contains an error!'));
         }
     }
     return $jsonDecoded;
 }
开发者ID:JohnEffland,项目名称:PartKeepr,代码行数:19,代码来源:DecodeConfiguration.php

示例4: changePassword

 public function changePassword()
 {
     if (Configuration::getOption("partkeepr.frontend.allow_password_change", true) === false) {
         throw new \Exception("Password changing has been disabled on this server");
     }
     if (!$this->getUser()->compareHashedPassword($this->getParameter("oldpassword"))) {
         throw new \Exception("Invalid Password");
     } else {
         $this->getUser()->setHashedPassword($this->getParameter("newpassword"));
     }
     return array("data" => PartKeepr::i18n("Password changed successfully"));
 }
开发者ID:JohnEffland,项目名称:PartKeepr,代码行数:12,代码来源:UserPreferenceService.php

示例5: deleteFootprint

 /**
  * Deletes the footprint with the given id.
  * 
  * @param int $id The footprint id to delete
  * @throws \PartKeepr\Util\SerializableException
  */
 public function deleteFootprint($id)
 {
     $footprint = Footprint::loadById($id);
     try {
         PartKeepr::getEM()->remove($footprint);
         PartKeepr::getEM()->flush();
     } catch (\PDOException $e) {
         if ($e->getCode() == "23000") {
             $exception = new SerializableException(sprintf(PartKeepr::i18n("Footprint %s is in use by some parts!"), $footprint->getName()));
             $exception->setDetail(sprintf(PartKeepr::i18n("You tried to delete the footprint %s, but there are parts which use this footprint."), $footprint->getName()));
             throw $exception;
         }
     }
 }
开发者ID:JohnEffland,项目名称:PartKeepr,代码行数:20,代码来源:FootprintManager.php

示例6: massCreate

 /**
  * Creates multiple storage locations at once. 
  * 
  * Requires that the parameter "storageLocations" is set to an array with the names of the storage locations.
  * Returns all error messages as "data" index in the result array.
  */
 public function massCreate()
 {
     $this->requireParameter("storageLocations");
     $aMessages = array();
     foreach ($this->getParameter("storageLocations") as $storageLocation) {
         try {
             $obj = StorageLocationManager::getInstance()->getStorageLocationByName($storageLocation);
             $aMessages[] = sprintf(PartKeepr::i18n("Storage Location %s already exists"), $storageLocation);
         } catch (\Exception $e) {
             $obj = new StorageLocation();
             $obj->setName($storageLocation);
             PartKeepr::getEM()->persist($obj);
         }
     }
     PartKeepr::getEM()->flush();
     return array("data" => $aMessages);
 }
开发者ID:JohnEffland,项目名称:PartKeepr,代码行数:23,代码来源:StorageLocationService.php

示例7: run

 /**
  * Sets up the default part unit if none exists
  */
 public function run()
 {
     $dql = "SELECT COUNT(p) FROM PartKeepr\\Part\\PartUnit p WHERE p.is_default = :default";
     $query = $this->entityManager->createQuery($dql);
     $query->setParameter("default", true);
     if ($query->getSingleScalarResult() == 0) {
         $partUnit = new PartUnit();
         $partUnit->setName(PartKeepr::i18n("Pieces"));
         $partUnit->setShortName(PartKeepr::i18n("pcs"));
         $partUnit->setDefault(true);
         $this->entityManager->persist($partUnit);
         $this->entityManager->flush();
         $this->logMessage("Added default part unit");
     } else {
         $this->logMessage("Skipped adding default part unit, because a default part unit already exists");
     }
 }
开发者ID:JohnEffland,项目名称:PartKeepr,代码行数:20,代码来源:PartUnitSetup.php

示例8: deleteCategory

 /**
  * Deletes the given category ID.
  * @param $id int The category id to delete
  * @throws CategoryNotFoundException If the category wasn't found
  */
 public function deleteCategory($id)
 {
     $category = $this->getCategory($id);
     try {
         if ($category->hasChildren()) {
             $exception = new SerializableException(sprintf(PartKeepr::i18n("Category '%s' contains other categories."), $category->getNode()->getName()));
             $exception->setDetail(sprintf(PartKeepr::i18n("You tried to delete the category '%s', but it still contains other categories. Please move the categories or delete them first."), $category->getNode()->getName()));
             throw $exception;
         }
         parent::deleteCategory($id);
     } catch (\PDOException $e) {
         if ($e->getCode() == "23000") {
             $exception = new SerializableException(sprintf(PartKeepr::i18n("Category '%s' contains parts."), $category->getNode()->getName()));
             $exception->setDetail(sprintf(PartKeepr::i18n("You tried to delete the category '%s', but it still contains parts. Please move the parts to another category."), $category->getNode()->getName()));
             throw $exception;
         } else {
             throw $e;
         }
     }
 }
开发者ID:JohnEffland,项目名称:PartKeepr,代码行数:25,代码来源:PartCategoryManager.php

示例9: __construct

 public function __construct()
 {
     parent::__construct(PartKeepr::i18n("Username or Password wrong."));
 }
开发者ID:JohnEffland,项目名称:PartKeepr,代码行数:4,代码来源:InvalidLoginDataException.php

示例10: checkPermissions

 /**
  * Checks if the path where the file should be stored has sufficient permissions to do so.
  * 
  * @throws SerializableException
  */
 public function checkPermissions()
 {
     if (!is_writable($this->getFilePath())) {
         throw new SerializableException(sprintf(PartKeepr::i18n("Unable to write to directory %s"), $this->getFilePath()));
     }
 }
开发者ID:JohnEffland,项目名称:PartKeepr,代码行数:11,代码来源:UploadedFile.php

示例11: doVersionCheck

 /**
  * Checks against the versions at partkeepr.org.
  * 
  * If a newer version was found, create a system notice entry.
  */
 public static function doVersionCheck()
 {
     $data = file_get_contents("http://www.partkeepr.org/versions.json");
     $versions = json_decode($data, true);
     if (PartKeeprVersion::PARTKEEPR_VERSION == "{V_GIT}") {
         return;
     }
     if (substr(PartKeeprVersion::PARTKEEPR_VERSION, 0, 17) == "partkeepr-nightly") {
         return;
     }
     if (version_compare(PartKeepr::getVersion(), $versions[0]["version"], '<')) {
         SystemNoticeManager::getInstance()->createUniqueSystemNotice("PARTKEEPR_VERSION_" . $versions[0]["version"], sprintf(PartKeepr::i18n("New PartKeepr Version %s available"), $versions[0]["version"]), sprintf(PartKeepr::i18n("PartKeepr Version %s changelog:"), $versions[0]["version"]) . "\n\n" . $versions[0]["changelog"]);
     }
 }
开发者ID:JohnEffland,项目名称:PartKeepr,代码行数:19,代码来源:PartKeepr.php

示例12: __construct

 /**
  * Constructs the exception
  * @param BaseEntity $entity
  */
 public function __construct(Part $part)
 {
     parent::__construct(PartKeepr::i18n("Part %s has no category assigned", $part));
 }
开发者ID:JohnEffland,项目名称:PartKeepr,代码行数:8,代码来源:CategoryNotAssignedException.php

示例13: array

    $aPreferences = array();
    foreach ($user->getPreferences() as $result) {
        $aPreferences[] = $result->serialize();
    }
    $aParameters["userPreferences"] = array("response" => array("data" => $aPreferences));
}
\Twig_Autoloader::register();
$loader = new \Twig_Loader_Filesystem(dirname(__FILE__) . '/templates/');
$twig = new \Twig_Environment($loader);
/* Information about maximum upload sizes */
$maxPostSize = PartKeepr::getBytesFromHumanReadable(ini_get("post_max_size"));
$maxFileSize = PartKeepr::getBytesFromHumanReadable(ini_get("upload_max_filesize"));
$aParameters["maxUploadSize"] = min($maxPostSize, $maxFileSize);
if (!class_exists("Imagick")) {
    $template = $twig->loadTemplate("error.tpl");
    echo $template->render(array("title" => PartKeepr::i18n("ImageMagick is not installed"), "error" => PartKeepr::i18n("You are missing the ImageMagick extension. Please install it and restart the setup to verify that the library was installed correctly.")));
    exit;
}
/* ImageMagick formats */
$imagick = new \Imagick();
$aParameters["availableImageFormats"] = $imagick->queryFormats();
/* Automatic Login */
if (Configuration::getOption("partkeepr.frontend.autologin.enabled", false) === true) {
    $aParameters["autoLoginUsername"] = Configuration::getOption("partkeepr.frontend.autologin.username");
    $aParameters["autoLoginPassword"] = Configuration::getOption("partkeepr.frontend.autologin.password");
}
if (Configuration::getOption("partkeepr.frontend.motd", false) !== false) {
    $aParameters["motd"] = Configuration::getOption("partkeepr.frontend.motd");
}
/* Load and render the template */
$template = $twig->loadTemplate("index.tpl");
开发者ID:JohnEffland,项目名称:PartKeepr,代码行数:31,代码来源:index.php

示例14: __construct

 public function __construct($username)
 {
     parent::__construct(sprintf(PartKeepr::i18n("The user %s doesn't exist. Maybe the user was already deleted."), $username));
 }
开发者ID:JohnEffland,项目名称:PartKeepr,代码行数:4,代码来源:UserDoesNotExistException.php

示例15: testAPC

 /**
  * Tests for APC. Throws an exception if APC is missing or not active.
  * @throws \Exception
  */
 public function testAPC()
 {
     if (!extension_loaded("apc")) {
         throw new \Exception(PartKeepr::i18n("The extension 'apc' is not loaded. Make sure that it is installed (see http://php.net/manual/en/apc.installation.php) and that it is enabled (set apc.enabled=1 in your php.ini)."));
     }
 }
开发者ID:JohnEffland,项目名称:PartKeepr,代码行数:10,代码来源:Setup.php


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