本文整理汇总了PHP中AttachmentFile::uploadLogo方法的典型用法代码示例。如果您正苦于以下问题:PHP AttachmentFile::uploadLogo方法的具体用法?PHP AttachmentFile::uploadLogo怎么用?PHP AttachmentFile::uploadLogo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttachmentFile
的用法示例。
在下文中一共展示了AttachmentFile::uploadLogo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updatePagesSettings
function updatePagesSettings($vars, &$errors)
{
global $ost;
$f = array();
$f['landing_page_id'] = array('type' => 'int', 'required' => 1, 'error' => 'required');
$f['offline_page_id'] = array('type' => 'int', 'required' => 1, 'error' => 'required');
$f['thank-you_page_id'] = array('type' => 'int', 'required' => 1, 'error' => 'required');
if ($_FILES['logo']) {
$error = false;
list($logo) = AttachmentFile::format($_FILES['logo']);
if (!$logo) {
} elseif ($logo['error']) {
$errors['logo'] = $logo['error'];
} elseif (!($id = AttachmentFile::uploadLogo($logo, $error))) {
$errors['logo'] = sprintf(__('Unable to upload logo image: %s'), $error);
}
}
$company = $ost->company;
$company_form = $company->getForm();
$company_form->setSource($_POST);
if (!$company_form->isValid()) {
$errors += $company_form->errors();
}
if (!Validator::process($f, $vars, $errors) || $errors) {
return false;
}
$company_form->save();
if (isset($vars['delete-logo'])) {
foreach ($vars['delete-logo'] as $id) {
if ($vars['selected-logo'] != $id && ($f = AttachmentFile::lookup($id))) {
$f->delete();
}
}
}
return $this->updateAll(array('landing_page_id' => $vars['landing_page_id'], 'offline_page_id' => $vars['offline_page_id'], 'thank-you_page_id' => $vars['thank-you_page_id'], 'client_logo_id' => is_numeric($vars['selected-logo']) && $vars['selected-logo'] ? $vars['selected-logo'] : false, 'staff_logo_id' => is_numeric($vars['selected-logo-scp']) && $vars['selected-logo-scp'] ? $vars['selected-logo-scp'] : false));
}
示例2: updatePagesSettings
function updatePagesSettings($vars, &$errors)
{
$f = array();
$f['landing_page_id'] = array('type' => 'int', 'required' => 1, 'error' => 'required');
$f['offline_page_id'] = array('type' => 'int', 'required' => 1, 'error' => 'required');
$f['thank-you_page_id'] = array('type' => 'int', 'required' => 1, 'error' => 'required');
if ($_FILES['logo']) {
$error = false;
list($logo) = AttachmentFile::format($_FILES['logo']);
if (!$logo) {
} elseif ($logo['error']) {
$errors['logo'] = $logo['error'];
} elseif (!($id = AttachmentFile::uploadLogo($logo, $error))) {
$errors['logo'] = 'Unable to upload logo image. ' . $error;
}
}
if (!Validator::process($f, $vars, $errors) || $errors) {
return false;
}
if (isset($vars['delete-logo'])) {
foreach ($vars['delete-logo'] as $id) {
if ($vars['selected-logo'] != $id && ($f = AttachmentFile::lookup($id))) {
$f->delete();
}
}
}
return $this->updateAll(array('landing_page_id' => $vars['landing_page_id'], 'offline_page_id' => $vars['offline_page_id'], 'thank-you_page_id' => $vars['thank-you_page_id'], 'client_logo_id' => is_numeric($vars['selected-logo']) && $vars['selected-logo'] ? $vars['selected-logo'] : false));
}