Beispiel #1
0
function fn_companies_update_logos($company_id, $old_logos)
{
    $logotypes = fn_filter_uploaded_data('logotypes');
    $areas = fn_companies_get_manifest_definition();
    // Update company logotypes
    if (!empty($logotypes)) {
        $logos = $old_logos;
        foreach ($logotypes as $type => $logo) {
            $area = $areas[$type];
            $short_name = "company/{$company_id}/{$type}_{$logo['name']}";
            $filename = DIR_IMAGES . $short_name;
            fn_mkdir(dirname($filename));
            if (fn_copy($logo['path'], $filename)) {
                list($w, $h, ) = fn_get_image_size($filename);
                $logos[$area['name']] = array('vendor' => 1, 'filename' => $short_name, 'width' => $w, 'height' => $h);
            } else {
                $text = fn_get_lang_var('text_cannot_create_file');
                $text = str_replace('[file]', $filename, $text);
                fn_set_notification('E', fn_get_lang_var('error'), $text);
            }
            @unlink($logo['path']);
        }
        $logos = serialize($logos);
        db_query("UPDATE ?:companies SET logos = ?s WHERE company_id = ?i", $logos, $company_id);
    }
    fn_save_logo_alt($areas, $company_id);
}
Beispiel #2
0
 $company_data = !empty($company_id) ? fn_get_company_data($company_id) : array();
 if ($mode == 'update' && empty($company_data)) {
     return array(CONTROLLER_STATUS_NO_PAGE);
 }
 if (!empty($_SESSION['saved_post_data']['company_data'])) {
     foreach ((array) $_SESSION['saved_post_data'] as $k => $v) {
         $view->assign($k, $v);
     }
     $company_data = $_SESSION['saved_post_data']['company_data'];
     unset($_SESSION['saved_post_data']['company_data']);
 } else {
     $view->assign('company_data', $company_data);
 }
 $view->assign('countries', fn_get_countries(CART_LANGUAGE, true));
 $view->assign('states', fn_get_all_states());
 $manifest_definition = fn_companies_get_manifest_definition();
 $view->assign('manifest_definition', $manifest_definition);
 $view->assign('manifests', array('customer' => fn_get_manifest('customer', CART_LANGUAGE, $company_id), 'admin' => fn_get_manifest('admin', CART_LANGUAGE, $company_id)));
 // [Breadcrumbs]
 if (PRODUCT_TYPE == 'MULTIVENDOR') {
     $lang_var = 'vendors';
 } else {
     $lang_var = 'suppliers';
 }
 fn_add_breadcrumb(fn_get_lang_var($lang_var), 'companies.manage');
 // [/Breadcrumbs]
 // [Page sections]
 $tabs['detailed'] = array('title' => fn_get_lang_var('general'), 'js' => true);
 if (PRODUCT_TYPE == 'MULTIVENDOR') {
     $tabs['description'] = array('title' => fn_get_lang_var('description'), 'js' => true);
     $tabs['logos'] = array('title' => fn_get_lang_var('logos'), 'js' => true);