本文整理汇总了PHP中Brand::setColors方法的典型用法代码示例。如果您正苦于以下问题:PHP Brand::setColors方法的具体用法?PHP Brand::setColors怎么用?PHP Brand::setColors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Brand
的用法示例。
在下文中一共展示了Brand::setColors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeAddNewBrand
public function executeAddNewBrand()
{
$this->setLayout(false);
$this->trademarkTypes = UtilsHelper::loadTrademarkTypes();
if ($brand = Document::getDocumentInstance($this->getRequestParameter('brand_id'))) {
if (get_class($brand) != 'Brand') {
$brand = null;
}
}
if (!$brand) {
$brand = new Brand();
}
$ownersArr = array();
$root = Rootfolder::getRootfolderByModule('clients');
$owners = Document::getChildrenOf($root->getId(), 'Client');
foreach ($owners as $ow) {
$ownersArr[$ow->getId()] = $ow->getLabel();
}
$this->ownersArr = $ownersArr;
$success = false;
if ($this->getRequestParameter('submit') > '') {
// check input data
$request = $this->getRequest();
$params = $request->getParameterHolder()->getAll();
//var_dump($params);
$errors = false;
$fields = array("label" => 'Наименование', "application_number" => 'Заявка номер', "register_number" => 'Регистров номер', "registration_date" => 'Дата на регистриране', "kind" => 'Тип', "application_date" => 'Дата на заявяване', "expires_on" => 'Срок', "nice_classes" => 'Класове по Ницска класификация', "rights_owner" => 'Притежател', "rights_representative" => 'Представител', "office_of_origin" => 'Държава на регистрация', "designated_contracting_party" => 'Държави в които е в сила');
foreach ($fields as $fl => $label) {
$val = trim($params[$fl]);
if ($val == '') {
if ($fl == 'rights_owner') {
if ($params['owner'] == '') {
$errors = true;
$request->setError('err' . $fl, '- ' . $label);
}
} else {
$errors = true;
$request->setError('err' . $fl, '- ' . $label);
}
}
}
$image = null;
if ($errors) {
UtilsHelper::setFlashMsg('Моля, въведете необходимите данни:<br>', UtilsHelper::MSG_ERROR);
} else {
if ($request->getFileName('image')) {
try {
$image = Media::upload('image', 'upload', array('image/gif', 'image/jpeg', 'image/jpg', 'image/png'));
//var_dump($image);
list($w, $h) = getimagesize($image->getServerAbsoluteUrl());
if ($w > $h) {
$image->resizeImage("thumbs", null, 105);
} else {
$image->resizeImage("thumbs", 95);
}
} catch (Exception $e) {
$errors = true;
$request->setError('errImage', '- ' . UtilsHelper::Localize('media.' . $e->getMessage()));
}
}
if ($errors) {
// remove uploaded image
if ($image) {
$image->delete();
}
UtilsHelper::setFlashMsg('Моля, коригирайте:<br>', UtilsHelper::MSG_ERROR);
}
}
// if everithing is OK
if (!$errors) {
//$brand = new Brand();
$brand->setLabel($params['label']);
if ($params['owner'] > '') {
$brand->setClientId($params['owner']);
$client = Document::getDocumentInstance($params['owner']);
$brand->setRightsOwner($client->getLabel());
} else {
$val = trim($params['rights_owner']);
$client = new Client();
$client->setLabel($val);
$client->save();
$brand->setClientId($client->getId());
$this->client = $client;
$brand->setRightsOwner($val);
}
$brand->setApplicationNumber($params['application_number']);
$brand->setRegisterNumber($params['register_number']);
$brand->setRegistrationDate($params['registration_date']);
$brand->setKind($params['kind']);
$brand->setApplicationDate($params['application_date']);
$brand->setStatus($params['status']);
$brand->setExpiresOn($params['expires_on']);
$brand->setViennaClasses(str_replace(' ', '', $params['vienna_classes']));
$brand->setColors($params['colors']);
$brand->setNiceClasses(str_replace(' ', '', $params['nice_classes']));
$brand->setRightsOwnerAddress($params['rights_owner_address']);
$brand->setRightsRepresentative($params['rights_representative']);
$brand->setRightsRepresentativeAddress($params['rights_representative_address']);
$brand->setOfficeOfOrigin($params['office_of_origin']);
$brand->setDesignatedContractingParty($params['designated_contracting_party']);
//.........这里部分代码省略.........