diff --git a/public/images/org_recognized_student_example.png b/public/images/org_recognized_student_example.png new file mode 100644 index 0000000000000000000000000000000000000000..dba9eb6f414670800fd129e132ea25d171cc6689 Binary files /dev/null and b/public/images/org_recognized_student_example.png differ diff --git a/public/images/org_recognized_student_vert_example.png b/public/images/org_recognized_student_vert_example.png new file mode 100644 index 0000000000000000000000000000000000000000..c569733076cc47ae35ba011d11fa9b21c19d36b5 Binary files /dev/null and b/public/images/org_recognized_student_vert_example.png differ diff --git a/src/Controllers/LockupsController.php b/src/Controllers/LockupsController.php index 96f7cd02e148fb88fac955020d39a10af7ed6ebb..d58b9f68bbf09779d62c354362010fc8c78f67db 100644 --- a/src/Controllers/LockupsController.php +++ b/src/Controllers/LockupsController.php @@ -8,403 +8,409 @@ use \SvgGenerator as SVG; class LockupsController extends Controller { - const LOCKUP_VERSION = '1.5'; - - private static function checkTextFieldLength($params, $field, $max_length) { - if (mb_strlen($params[$field]) > $max_length) { - self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Invalid Text', ucwords(implode(' ',explode('_', $field))) . ' must be ' . $max_length . ' characters or fewer.'); - return FALSE; - } - - if (empty($params[$field])) { - self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Invalid Text', ucwords(implode(' ',explode('_', $field))) . ' must not be empty.'); - return FALSE; - } - - return TRUE; - } - - public static function createAction() { - \Core::$breadcrumbs[] = array('text' => 'Create Lockup'); - - $context = new \stdClass; - if (isset($_SESSION['create_lockup'])) { - $context->lockup = $_SESSION['create_lockup']; - unset($_SESSION['create_lockup']); - } else { - $context->lockup = new Lockup; - } - $context->approvers = User::find('all', array('conditions' => array('role' => 'approver'))); - return self::renderView('new_lockup', $context); - } - - public static function postCreateAction($post_params) { - self::requireAuth(); - - # take the params and generate a base lockup from that template - $lockup = new \stdClass; - - $lockup->org_name = strtoupper($post_params['organization']); - $lockup->org_second_line = strtoupper($post_params['organization_second_line']); - $lockup->subject = $post_params['subject']; - $lockup->subject_second_line = $post_params['subject_second_line']; - $lockup->acronym = $post_params['acronym']; - $lockup->acronym_second_line = $post_params['acronym_second_line']; - $lockup->acronym_subject = $post_params['acronym_subject']; - $lockup->extension_county = $post_params['extension_county']; - $lockup->style = $post_params['type']; - - # set preview to true - $lockup->preview = TRUE; - - $svg_text = SVG::createPreviewLockup($post_params['type'], $lockup)->svg_text; - $vert_svg_text = SVG::createPreviewLockup($post_params['type'], $lockup, 'vert')->svg_text; - $model = new Lockup(array( - 'organization' => strtoupper($post_params['organization']), - 'organization_second_line' => strtoupper($post_params['organization_second_line']), - 'subject' => $post_params['subject'], - 'subject_second_line' => $post_params['subject_second_line'], - 'acronym' => $post_params['acronym'], - 'acronym_second_line' => $post_params['acronym_second_line'], - 'acronym_subject' => $post_params['acronym_subject'], - 'extension_county' => $post_params['extension_county'], - 'style' => $post_params['type'], - 'user_id' => \Auth::$current_user->id, - 'date_created' => date('Y-m-d H:i:s'), - 'preview_svg' => $svg_text, - 'vert_preview_svg' => $vert_svg_text, - 'approver_id' => empty($post_params['approver']) ? NULL : $post_params['approver'], - 'file_organization' => $post_params['file_organization'], - 'file_organization_acronym' => $post_params['file_organization_acronym'], - 'file_department' => $post_params['file_department'], - 'file_department_acronym' => $post_params['file_department_acronym'], - 'version' => NULL - )); - - $valid = TRUE; - # validate the lengths of fields - switch ($lockup->style) { - case 'org_only': - $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); - break; - case 'org_two_line': - $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); - $valid = $valid && self::checkTextFieldLength($post_params, 'organization_second_line', 31); - break; - case 'org_subject': - $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); - $valid = $valid && self::checkTextFieldLength($post_params, 'subject', 40); - break; - case 'org_subject_1_2': - $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); - $valid = $valid && self::checkTextFieldLength($post_params, 'subject', 40); - $valid = $valid && self::checkTextFieldLength($post_params, 'subject_second_line', 40); - break; - case 'org_subject_2_1': - $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); - $valid = $valid && self::checkTextFieldLength($post_params, 'organization_second_line', 31); - $valid = $valid && self::checkTextFieldLength($post_params, 'subject', 40); - break; - case 'org_subject_2_2': - $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); - $valid = $valid && self::checkTextFieldLength($post_params, 'organization_second_line', 31); - $valid = $valid && self::checkTextFieldLength($post_params, 'subject', 40); - $valid = $valid && self::checkTextFieldLength($post_params, 'subject_second_line', 40); - break; - case 'acronym': - $valid = $valid && self::checkTextFieldLength($post_params, 'acronym', 10); - break; - case 'acronym_subject': - $valid = $valid && self::checkTextFieldLength($post_params, 'acronym', 10); - $valid = $valid && self::checkTextFieldLength($post_params, 'acronym_subject', 15); - break; - case 'acronym_subject_2_1': - $valid = $valid && self::checkTextFieldLength($post_params, 'acronym', 10); - $valid = $valid && self::checkTextFieldLength($post_params, 'acronym_second_line', 10); - $valid = $valid && self::checkTextFieldLength($post_params, 'acronym_subject', 15); - break; - case 'acronym_social': - $valid = $valid && self::checkTextFieldLength($post_params, 'acronym', 10); - break; - case 'extension': - $valid = $valid && self::checkTextFieldLength($post_params, 'extension_county', 40); - break; - case 'ncta': - $valid = $valid && self::checkTextFieldLength($post_params, 'subject', 40); - break; - case 'extension_4h': - $valid = $valid && self::checkTextFieldLength($post_params, 'extension_county', 40); - break; - default; - self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Invalid Style', 'Somehow you selected an invalid style. Please select one and try again.'); - $valid = FALSE; - break; - } - - if (!$valid) { - # store this lockup in the session so it can be seen on the page - $_SESSION['create_lockup'] = $model; - \Core::redirect('/lockups/create/'); - } - - try { - $model->save(); - } catch (\Exception $e) { - self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Error', 'The lockup failed to create.'); - \Core::redirect('/lockups/create/'); - } - \Core::redirect($model->getPreviewURL()); - } - - public static function editAction($get_params) { - self::requireAuth(); - \Core::$breadcrumbs[] = array('text' => 'Edit Lockup'); - - if (empty($get_params['id'])) { - \Core::notFound(); - } - - $id = $get_params['id']; - try { - $lockup = Lockup::find($id); - } catch (\ActiveRecord\RecordNotFound $e) { - \Core::notFound('That lockup could not be found.'); - } - - # the user must have submitted the lockup or be an admin to edit - if ($lockup->user_id != \Auth::$current_user->id && !(\Auth::$current_user->isAdmin())) { - self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Unauthorized', 'Sorry, you are not allowed to edit that lockup.'); - \Core::redirect('/lockups/manage/'); - } - - # this lockup must not be generated - if ($lockup->isGenerated()) { - self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Cannot Edit', 'Sorry, this lockup has been generated and cannot be edited. Please create a new lockup.'); - \Core::redirect('/lockups/manage/'); - } - - $context = new \stdClass; - - if (isset($_SESSION['edit_lockup'])) { - $context->lockup = $_SESSION['edit_lockup']; - unset($_SESSION['edit_lockup']); - } else { - $context->lockup = $lockup; - } - $context->approvers = User::find('all', array('conditions' => array('role' => 'approver'))); - return self::renderView('new_lockup', $context); - } - - public static function postEditAction($post_params) { - self::requireAuth(); - - if (empty($post_params['id'])) { - \Core::notFound(); - } - - $id = $post_params['id']; - try { - $lockup_model = Lockup::find($id); - } catch (\ActiveRecord\RecordNotFound $e) { - \Core::notFound('That lockup could not be found.'); - } - - # the user must have submitted the lockup or be an admin to edit - if ($lockup_model->user_id != \Auth::$current_user->id && !(\Auth::$current_user->isAdmin())) { - self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Unauthorized', 'Sorry, you are not allowed to edit that lockup.'); - \Core::redirect('/lockups/manage/'); - } - - # this lockup must not be generated - if ($lockup_model->isGenerated()) { - self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Cannot Edit', 'Sorry, this lockup has been generated and cannot be edited. Please create a new lockup.'); - \Core::redirect('/lockups/manage/'); - } - - # take the params and generate a base lockup from that template - $lockup = new \stdClass; - - $lockup->org_name = strtoupper($post_params['organization']); - $lockup->org_second_line = strtoupper($post_params['organization_second_line']); - $lockup->subject = $post_params['subject']; - $lockup->subject_second_line = $post_params['subject_second_line']; - $lockup->acronym = $post_params['acronym']; - $lockup->acronym_second_line = $post_params['acronym_second_line']; - $lockup->acronym_subject = $post_params['acronym_subject']; - $lockup->extension_county = $post_params['extension_county']; - $lockup->style = $post_params['type']; - - # set preview to true - $lockup->preview = TRUE; - - $svg_text = SVG::createPreviewLockup($post_params['type'], $lockup)->svg_text; - $vert_svg_text = SVG::createPreviewLockup($post_params['type'], $lockup, 'vert')->svg_text; - - $lockup_model->organization = strtoupper($post_params['organization']); - $lockup_model->organization_second_line = strtoupper($post_params['organization_second_line']); - $lockup_model->subject = $post_params['subject']; - $lockup_model->subject_second_line = $post_params['subject_second_line']; - $lockup_model->acronym = $post_params['acronym']; - $lockup_model->acronym_second_line = $post_params['acronym_second_line']; - $lockup_model->acronym_subject = $post_params['acronym_subject']; - $lockup_model->extension_county = $post_params['extension_county']; - $lockup_model->style = $post_params['type']; - $lockup_model->user_id = \Auth::$current_user->id; - $lockup_model->date_created = date('Y-m-d H:i:s'); - $lockup_model->status = Lockup::AWAITING_APPROVAL; - $lockup_model->creative_status = Lockup::AWAITING_APPROVAL; - $lockup_model->preview_svg = $svg_text; - $lockup_model->vert_preview_svg = $vert_svg_text; - $lockup_model->approver_id = empty($post_params['approver']) ? NULL : $post_params['approver']; - $lockup_model->file_organization = $post_params['file_organization']; - $lockup_model->file_organization_acronym = $post_params['file_organization_acronym']; - $lockup_model->file_department = $post_params['file_department']; - $lockup_model->file_department_acronym = $post_params['file_department_acronym']; - - $valid = TRUE; - # validate the lengths of fields - switch ($lockup_model->style) { - case 'org_only': - $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); - break; - case 'org_two_line': - $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); - $valid = $valid && self::checkTextFieldLength($post_params, 'organization_second_line', 31); - break; - case 'org_subject': - $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); - $valid = $valid && self::checkTextFieldLength($post_params, 'subject', 40); - break; - case 'org_subject_1_2': - $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); - $valid = $valid && self::checkTextFieldLength($post_params, 'subject', 40); - $valid = $valid && self::checkTextFieldLength($post_params, 'subject_second_line', 40); - break; - case 'org_subject_2_1': - $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); - $valid = $valid && self::checkTextFieldLength($post_params, 'organization_second_line', 31); - $valid = $valid && self::checkTextFieldLength($post_params, 'subject', 40); - break; - case 'org_subject_2_2': - $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); - $valid = $valid && self::checkTextFieldLength($post_params, 'organization_second_line', 31); - $valid = $valid && self::checkTextFieldLength($post_params, 'subject', 40); - $valid = $valid && self::checkTextFieldLength($post_params, 'subject_second_line', 40); - break; - case 'acronym': - $valid = $valid && self::checkTextFieldLength($post_params, 'acronym', 10); - break; - case 'acronym_subject': - $valid = $valid && self::checkTextFieldLength($post_params, 'acronym', 10); - $valid = $valid && self::checkTextFieldLength($post_params, 'acronym_subject', 15); - break; - case 'acronym_subject_2_1': - $valid = $valid && self::checkTextFieldLength($post_params, 'acronym', 10); - $valid = $valid && self::checkTextFieldLength($post_params, 'acronym_second_line', 10); - $valid = $valid && self::checkTextFieldLength($post_params, 'acronym_subject', 15); - break; - case 'acronym_social': - $valid = $valid && self::checkTextFieldLength($post_params, 'acronym', 10); - break; - case 'extension': - $valid = $valid && self::checkTextFieldLength($post_params, 'extension_county', 40); - break; - case 'ncta': - $valid = $valid && self::checkTextFieldLength($post_params, 'subject', 40); - break; - case 'extension_4h': - $valid = $valid && self::checkTextFieldLength($post_params, 'extension_county', 40); - break; - default; - self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Invalid Style', 'Somehow you selected an invalid style. Please select one and try again.'); - $valid = FALSE; - break; - } - - if (!$valid) { - # store this lockup in the session so it can be seen on the page - $_SESSION['edit_lockup'] = $lockup_model; - \Core::redirect($lockup_model->getEditURL()); - } - - try { - $lockup_model->save(); - } catch (\Exception $e) { - self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Error', 'The lockup failed to update.'); - \Core::redirect($lockup_model->getEditURL()); - } - - \Core::redirect($lockup_model->getPreviewURL()); - } - - public static function previewAction($get_params) { - self::requireAuth(); - \Core::$breadcrumbs[] = array('text' => 'Preview Lockup'); - - if (empty($get_params['id'])) { - \Core::notFound(); - } - - $id = $get_params['id']; - try { - $lockup = Lockup::find($id); - } catch (\ActiveRecord\RecordNotFound $e) { - \Core::notFound('That lockup could not be found.'); - } - - if ($lockup->isGenerated()) { - \Core::redirect($lockup->getDownloadURL()); - } - - $context = new \stdClass; - $context->lockup = $lockup; - - return self::renderView('preview_lockup', $context); - } - - public static function postApproveAction($post_params) { - self::requireAuth(); - - if (empty($post_params['id'])) { - \Core::notFound(); - } - - $id = $post_params['id']; - try { - $lockup = Lockup::find($id); - } catch (\ActiveRecord\RecordNotFound $e) { - \Core::notFound('That lockup could not be found.'); - } - - if (\Auth::$current_user->isAdmin()) { - $lockup->status = Lockup::APPROVED; - $lockup->creative_status = Lockup::APPROVED; - $lockup->creative_feedback = $post_params['creative_feedback']; - $lockup->communicator_feedback = $post_params['communicator_feedback']; - } else if (\Auth::$current_user->isCreative()) { - $lockup->creative_feedback = $post_params['creative_feedback']; - if ($lockup->user->id == \Auth::$current_user->id) { - // creative users can full approve their own lockups - $lockup->status = Lockup::APPROVED; - $lockup->creative_status = Lockup::APPROVED; - // if they do so, remove the approver - $lockup->approver_id = NULL; - } else if (empty($lockup->approver_id)) { - // creative users can full approve lockups with no communicator - $lockup->status = Lockup::APPROVED; - $lockup->creative_status = Lockup::APPROVED; - } else { - $lockup->creative_status = Lockup::APPROVED; - } - } else if (\Auth::$current_user->isApprover() && $lockup->approver_id == \Auth::$current_user->id) { - $lockup->communicator_feedback = $post_params['communicator_feedback']; - $lockup->status = Lockup::APPROVED; - } - $lockup->save(); - - # send an email - if ($lockup->status == Lockup::APPROVED && $lockup->creative_status == Lockup::APPROVED) { - $body = ' + const LOCKUP_VERSION = '1.5'; + + private static function checkTextFieldLength($params, $field, $max_length) { + if (mb_strlen($params[$field]) > $max_length) { + self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Invalid Text', ucwords(implode(' ',explode('_', $field))) . ' must be ' . $max_length . ' characters or fewer.'); + return FALSE; + } + + if (empty($params[$field])) { + self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Invalid Text', ucwords(implode(' ',explode('_', $field))) . ' must not be empty.'); + return FALSE; + } + + return TRUE; + } + + public static function createAction() { + \Core::$breadcrumbs[] = array('text' => 'Create Lockup'); + + $context = new \stdClass; + if (isset($_SESSION['create_lockup'])) { + $context->lockup = $_SESSION['create_lockup']; + unset($_SESSION['create_lockup']); + } else { + $context->lockup = new Lockup; + } + $context->approvers = User::find('all', array('conditions' => array('role' => 'approver'))); + return self::renderView('new_lockup', $context); + } + + public static function postCreateAction($post_params) { + self::requireAuth(); + + # take the params and generate a base lockup from that template + $lockup = new \stdClass; + + $lockup->org_name = strtoupper($post_params['organization']); + $lockup->org_second_line = strtoupper($post_params['organization_second_line']); + $lockup->subject = $post_params['subject']; + $lockup->subject_second_line = $post_params['subject_second_line']; + $lockup->acronym = $post_params['acronym']; + $lockup->acronym_second_line = $post_params['acronym_second_line']; + $lockup->acronym_subject = $post_params['acronym_subject']; + $lockup->extension_county = $post_params['extension_county']; + $lockup->style = $post_params['type']; + + # set preview to true + $lockup->preview = TRUE; + + $svg_text = SVG::createPreviewLockup($post_params['type'], $lockup)->svg_text; + $vert_svg_text = SVG::createPreviewLockup($post_params['type'], $lockup, 'vert')->svg_text; + $model = new Lockup(array( + 'organization' => strtoupper($post_params['organization']), + 'organization_second_line' => strtoupper($post_params['organization_second_line']), + 'subject' => $post_params['subject'], + 'subject_second_line' => $post_params['subject_second_line'], + 'acronym' => $post_params['acronym'], + 'acronym_second_line' => $post_params['acronym_second_line'], + 'acronym_subject' => $post_params['acronym_subject'], + 'extension_county' => $post_params['extension_county'], + 'style' => $post_params['type'], + 'user_id' => \Auth::$current_user->id, + 'date_created' => date('Y-m-d H:i:s'), + 'preview_svg' => $svg_text, + 'vert_preview_svg' => $vert_svg_text, + 'approver_id' => empty($post_params['approver']) ? NULL : $post_params['approver'], + 'file_organization' => $post_params['file_organization'], + 'file_organization_acronym' => $post_params['file_organization_acronym'], + 'file_department' => $post_params['file_department'], + 'file_department_acronym' => $post_params['file_department_acronym'], + 'version' => NULL + )); + + $valid = TRUE; + # validate the lengths of fields + switch ($lockup->style) { + case 'org_only': + $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); + break; + case 'org_two_line': + $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); + $valid = $valid && self::checkTextFieldLength($post_params, 'organization_second_line', 31); + break; + case 'org_subject': + $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); + $valid = $valid && self::checkTextFieldLength($post_params, 'subject', 40); + break; + case 'org_recognized_student': + $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); + break; + case 'org_subject_1_2': + $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); + $valid = $valid && self::checkTextFieldLength($post_params, 'subject', 40); + $valid = $valid && self::checkTextFieldLength($post_params, 'subject_second_line', 40); + break; + case 'org_subject_2_1': + $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); + $valid = $valid && self::checkTextFieldLength($post_params, 'organization_second_line', 31); + $valid = $valid && self::checkTextFieldLength($post_params, 'subject', 40); + break; + case 'org_subject_2_2': + $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); + $valid = $valid && self::checkTextFieldLength($post_params, 'organization_second_line', 31); + $valid = $valid && self::checkTextFieldLength($post_params, 'subject', 40); + $valid = $valid && self::checkTextFieldLength($post_params, 'subject_second_line', 40); + break; + case 'acronym': + $valid = $valid && self::checkTextFieldLength($post_params, 'acronym', 10); + break; + case 'acronym_subject': + $valid = $valid && self::checkTextFieldLength($post_params, 'acronym', 10); + $valid = $valid && self::checkTextFieldLength($post_params, 'acronym_subject', 15); + break; + case 'acronym_subject_2_1': + $valid = $valid && self::checkTextFieldLength($post_params, 'acronym', 10); + $valid = $valid && self::checkTextFieldLength($post_params, 'acronym_second_line', 10); + $valid = $valid && self::checkTextFieldLength($post_params, 'acronym_subject', 15); + break; + case 'acronym_social': + $valid = $valid && self::checkTextFieldLength($post_params, 'acronym', 10); + break; + case 'extension': + $valid = $valid && self::checkTextFieldLength($post_params, 'extension_county', 40); + break; + case 'ncta': + $valid = $valid && self::checkTextFieldLength($post_params, 'subject', 40); + break; + case 'extension_4h': + $valid = $valid && self::checkTextFieldLength($post_params, 'extension_county', 40); + break; + default; + self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Invalid Style', 'Somehow you selected an invalid style. Please select one and try again.'); + $valid = FALSE; + break; + } + + if (!$valid) { + # store this lockup in the session so it can be seen on the page + $_SESSION['create_lockup'] = $model; + \Core::redirect('/lockups/create/'); + } + + try { + $model->save(); + } catch (\Exception $e) { + self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Error', 'The lockup failed to create.'); + \Core::redirect('/lockups/create/'); + } + \Core::redirect($model->getPreviewURL()); + } + + public static function editAction($get_params) { + self::requireAuth(); + \Core::$breadcrumbs[] = array('text' => 'Edit Lockup'); + + if (empty($get_params['id'])) { + \Core::notFound(); + } + + $id = $get_params['id']; + try { + $lockup = Lockup::find($id); + } catch (\ActiveRecord\RecordNotFound $e) { + \Core::notFound('That lockup could not be found.'); + } + + # the user must have submitted the lockup or be an admin to edit + if ($lockup->user_id != \Auth::$current_user->id && !(\Auth::$current_user->isAdmin())) { + self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Unauthorized', 'Sorry, you are not allowed to edit that lockup.'); + \Core::redirect('/lockups/manage/'); + } + + # this lockup must not be generated + if ($lockup->isGenerated()) { + self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Cannot Edit', 'Sorry, this lockup has been generated and cannot be edited. Please create a new lockup.'); + \Core::redirect('/lockups/manage/'); + } + + $context = new \stdClass; + + if (isset($_SESSION['edit_lockup'])) { + $context->lockup = $_SESSION['edit_lockup']; + unset($_SESSION['edit_lockup']); + } else { + $context->lockup = $lockup; + } + $context->approvers = User::find('all', array('conditions' => array('role' => 'approver'))); + return self::renderView('new_lockup', $context); + } + + public static function postEditAction($post_params) { + self::requireAuth(); + + if (empty($post_params['id'])) { + \Core::notFound(); + } + + $id = $post_params['id']; + try { + $lockup_model = Lockup::find($id); + } catch (\ActiveRecord\RecordNotFound $e) { + \Core::notFound('That lockup could not be found.'); + } + + # the user must have submitted the lockup or be an admin to edit + if ($lockup_model->user_id != \Auth::$current_user->id && !(\Auth::$current_user->isAdmin())) { + self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Unauthorized', 'Sorry, you are not allowed to edit that lockup.'); + \Core::redirect('/lockups/manage/'); + } + + # this lockup must not be generated + if ($lockup_model->isGenerated()) { + self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Cannot Edit', 'Sorry, this lockup has been generated and cannot be edited. Please create a new lockup.'); + \Core::redirect('/lockups/manage/'); + } + + # take the params and generate a base lockup from that template + $lockup = new \stdClass; + + $lockup->org_name = strtoupper($post_params['organization']); + $lockup->org_second_line = strtoupper($post_params['organization_second_line']); + $lockup->subject = $post_params['subject']; + $lockup->subject_second_line = $post_params['subject_second_line']; + $lockup->acronym = $post_params['acronym']; + $lockup->acronym_second_line = $post_params['acronym_second_line']; + $lockup->acronym_subject = $post_params['acronym_subject']; + $lockup->extension_county = $post_params['extension_county']; + $lockup->style = $post_params['type']; + + # set preview to true + $lockup->preview = TRUE; + + $svg_text = SVG::createPreviewLockup($post_params['type'], $lockup)->svg_text; + $vert_svg_text = SVG::createPreviewLockup($post_params['type'], $lockup, 'vert')->svg_text; + + $lockup_model->organization = strtoupper($post_params['organization']); + $lockup_model->organization_second_line = strtoupper($post_params['organization_second_line']); + $lockup_model->subject = $post_params['subject']; + $lockup_model->subject_second_line = $post_params['subject_second_line']; + $lockup_model->acronym = $post_params['acronym']; + $lockup_model->acronym_second_line = $post_params['acronym_second_line']; + $lockup_model->acronym_subject = $post_params['acronym_subject']; + $lockup_model->extension_county = $post_params['extension_county']; + $lockup_model->style = $post_params['type']; + $lockup_model->user_id = \Auth::$current_user->id; + $lockup_model->date_created = date('Y-m-d H:i:s'); + $lockup_model->status = Lockup::AWAITING_APPROVAL; + $lockup_model->creative_status = Lockup::AWAITING_APPROVAL; + $lockup_model->preview_svg = $svg_text; + $lockup_model->vert_preview_svg = $vert_svg_text; + $lockup_model->approver_id = empty($post_params['approver']) ? NULL : $post_params['approver']; + $lockup_model->file_organization = $post_params['file_organization']; + $lockup_model->file_organization_acronym = $post_params['file_organization_acronym']; + $lockup_model->file_department = $post_params['file_department']; + $lockup_model->file_department_acronym = $post_params['file_department_acronym']; + + $valid = TRUE; + # validate the lengths of fields + switch ($lockup_model->style) { + case 'org_only': + $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); + break; + case 'org_two_line': + $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); + $valid = $valid && self::checkTextFieldLength($post_params, 'organization_second_line', 31); + break; + case 'org_subject': + $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); + $valid = $valid && self::checkTextFieldLength($post_params, 'subject', 40); + break; + case 'org_recognized_student': + $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); + break; + case 'org_subject_1_2': + $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); + $valid = $valid && self::checkTextFieldLength($post_params, 'subject', 40); + $valid = $valid && self::checkTextFieldLength($post_params, 'subject_second_line', 40); + break; + case 'org_subject_2_1': + $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); + $valid = $valid && self::checkTextFieldLength($post_params, 'organization_second_line', 31); + $valid = $valid && self::checkTextFieldLength($post_params, 'subject', 40); + break; + case 'org_subject_2_2': + $valid = $valid && self::checkTextFieldLength($post_params, 'organization', 31); + $valid = $valid && self::checkTextFieldLength($post_params, 'organization_second_line', 31); + $valid = $valid && self::checkTextFieldLength($post_params, 'subject', 40); + $valid = $valid && self::checkTextFieldLength($post_params, 'subject_second_line', 40); + break; + case 'acronym': + $valid = $valid && self::checkTextFieldLength($post_params, 'acronym', 10); + break; + case 'acronym_subject': + $valid = $valid && self::checkTextFieldLength($post_params, 'acronym', 10); + $valid = $valid && self::checkTextFieldLength($post_params, 'acronym_subject', 15); + break; + case 'acronym_subject_2_1': + $valid = $valid && self::checkTextFieldLength($post_params, 'acronym', 10); + $valid = $valid && self::checkTextFieldLength($post_params, 'acronym_second_line', 10); + $valid = $valid && self::checkTextFieldLength($post_params, 'acronym_subject', 15); + break; + case 'acronym_social': + $valid = $valid && self::checkTextFieldLength($post_params, 'acronym', 10); + break; + case 'extension': + $valid = $valid && self::checkTextFieldLength($post_params, 'extension_county', 40); + break; + case 'ncta': + $valid = $valid && self::checkTextFieldLength($post_params, 'subject', 40); + break; + case 'extension_4h': + $valid = $valid && self::checkTextFieldLength($post_params, 'extension_county', 40); + break; + default; + self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Invalid Style', 'Somehow you selected an invalid style. Please select one and try again.'); + $valid = FALSE; + break; + } + + if (!$valid) { + # store this lockup in the session so it can be seen on the page + $_SESSION['edit_lockup'] = $lockup_model; + \Core::redirect($lockup_model->getEditURL()); + } + + try { + $lockup_model->save(); + } catch (\Exception $e) { + self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Error', 'The lockup failed to update.'); + \Core::redirect($lockup_model->getEditURL()); + } + + \Core::redirect($lockup_model->getPreviewURL()); + } + + public static function previewAction($get_params) { + self::requireAuth(); + \Core::$breadcrumbs[] = array('text' => 'Preview Lockup'); + + if (empty($get_params['id'])) { + \Core::notFound(); + } + + $id = $get_params['id']; + try { + $lockup = Lockup::find($id); + } catch (\ActiveRecord\RecordNotFound $e) { + \Core::notFound('That lockup could not be found.'); + } + + if ($lockup->isGenerated()) { + \Core::redirect($lockup->getDownloadURL()); + } + + $context = new \stdClass; + $context->lockup = $lockup; + + return self::renderView('preview_lockup', $context); + } + + public static function postApproveAction($post_params) { + self::requireAuth(); + + if (empty($post_params['id'])) { + \Core::notFound(); + } + + $id = $post_params['id']; + try { + $lockup = Lockup::find($id); + } catch (\ActiveRecord\RecordNotFound $e) { + \Core::notFound('That lockup could not be found.'); + } + + if (\Auth::$current_user->isAdmin()) { + $lockup->status = Lockup::APPROVED; + $lockup->creative_status = Lockup::APPROVED; + $lockup->creative_feedback = $post_params['creative_feedback']; + $lockup->communicator_feedback = $post_params['communicator_feedback']; + } else if (\Auth::$current_user->isCreative()) { + $lockup->creative_feedback = $post_params['creative_feedback']; + if ($lockup->user->id == \Auth::$current_user->id) { + // creative users can full approve their own lockups + $lockup->status = Lockup::APPROVED; + $lockup->creative_status = Lockup::APPROVED; + // if they do so, remove the approver + $lockup->approver_id = NULL; + } else if (empty($lockup->approver_id)) { + // creative users can full approve lockups with no communicator + $lockup->status = Lockup::APPROVED; + $lockup->creative_status = Lockup::APPROVED; + } else { + $lockup->creative_status = Lockup::APPROVED; + } + } else if (\Auth::$current_user->isApprover() && $lockup->approver_id == \Auth::$current_user->id) { + $lockup->communicator_feedback = $post_params['communicator_feedback']; + $lockup->status = Lockup::APPROVED; + } + $lockup->save(); + + # send an email + if ($lockup->status == Lockup::APPROVED && $lockup->creative_status == Lockup::APPROVED) { + $body = ' Your lockup, ' . $lockup->getName() . ', has been approved and is ready to generate. <br><br> Please visit <a href="http://lockups.unl.edu' . $lockup->getPreviewURL() . '">http://lockups.unl.edu' . $lockup->getPreviewURL() . '</a> to generate its files. @@ -419,50 +425,50 @@ If you can\'t see your lockups or if there are issues with any versions, please <br><br> UNL Lockup Factory'; - Emailer::sendMail($lockup->user->email, "Lockup Approved", $body); - } - - \Core::redirect($lockup->getPreviewURL()); - } - - public static function postFeedbackAction($post_params) { - self::requireAuth(); - - if (empty($post_params['id'])) { - \Core::notFound(); - } - - $id = $post_params['id']; - try { - $lockup = Lockup::find($id); - } catch (\ActiveRecord\RecordNotFound $e) { - \Core::notFound('That lockup could not be found.'); - } - - if (\Auth::$current_user->isAdmin()) { - if ($lockup->status == Lockup::AWAITING_APPROVAL) { - $lockup->status = Lockup::FEEDBACK_GIVEN; - } - if ($lockup->creative_status == Lockup::AWAITING_APPROVAL) { - $lockup->creative_status = Lockup::FEEDBACK_GIVEN; - } - $lockup->creative_feedback = $post_params['creative_feedback']; - $lockup->communicator_feedback = $post_params['communicator_feedback']; - } else if (\Auth::$current_user->isCreative()) { - $lockup->creative_feedback = $post_params['creative_feedback']; - if ($lockup->creative_status == Lockup::AWAITING_APPROVAL) { - $lockup->creative_status = Lockup::FEEDBACK_GIVEN; - } - } else if (\Auth::$current_user->isApprover() && $lockup->approver_id == \Auth::$current_user->id) { - $lockup->communicator_feedback = $post_params['communicator_feedback']; - if ($lockup->status == Lockup::AWAITING_APPROVAL) { - $lockup->status = Lockup::FEEDBACK_GIVEN; - } - } - $lockup->save(); - - # send an email - $body = ' + Emailer::sendMail($lockup->user->email, "Lockup Approved", $body); + } + + \Core::redirect($lockup->getPreviewURL()); + } + + public static function postFeedbackAction($post_params) { + self::requireAuth(); + + if (empty($post_params['id'])) { + \Core::notFound(); + } + + $id = $post_params['id']; + try { + $lockup = Lockup::find($id); + } catch (\ActiveRecord\RecordNotFound $e) { + \Core::notFound('That lockup could not be found.'); + } + + if (\Auth::$current_user->isAdmin()) { + if ($lockup->status == Lockup::AWAITING_APPROVAL) { + $lockup->status = Lockup::FEEDBACK_GIVEN; + } + if ($lockup->creative_status == Lockup::AWAITING_APPROVAL) { + $lockup->creative_status = Lockup::FEEDBACK_GIVEN; + } + $lockup->creative_feedback = $post_params['creative_feedback']; + $lockup->communicator_feedback = $post_params['communicator_feedback']; + } else if (\Auth::$current_user->isCreative()) { + $lockup->creative_feedback = $post_params['creative_feedback']; + if ($lockup->creative_status == Lockup::AWAITING_APPROVAL) { + $lockup->creative_status = Lockup::FEEDBACK_GIVEN; + } + } else if (\Auth::$current_user->isApprover() && $lockup->approver_id == \Auth::$current_user->id) { + $lockup->communicator_feedback = $post_params['communicator_feedback']; + if ($lockup->status == Lockup::AWAITING_APPROVAL) { + $lockup->status = Lockup::FEEDBACK_GIVEN; + } + } + $lockup->save(); + + # send an email + $body = ' Feedback has been left on your lockup, ' . $lockup->getName() . '. <br><br> Please visit <a href="http://lockups.unl.edu' . $lockup->getPreviewURL() . '">http://lockups.unl.edu' . $lockup->getPreviewURL() . '</a> to view your lockup, and edit it if necessary. @@ -477,41 +483,41 @@ If you can\'t see your lockups or if there are issues with any versions, please <br><br> UNL Lockup Factory'; - Emailer::sendMail($lockup->user->email, "Lockup Feedback Given", $body); - - \Core::redirect($lockup->getPreviewURL()); - } - - public static function postDenyAction($post_params) { - self::requireAuth(); - - if (empty($post_params['id'])) { - \Core::notFound(); - } - - $id = $post_params['id']; - try { - $lockup = Lockup::find($id); - } catch (\ActiveRecord\RecordNotFound $e) { - \Core::notFound('That lockup could not be found.'); - } - - if (\Auth::$current_user->isAdmin()) { - $lockup->status = Lockup::DENIED; - $lockup->creative_status = Lockup::DENIED; - $lockup->creative_feedback = $post_params['creative_feedback']; - $lockup->communicator_feedback = $post_params['communicator_feedback']; - } else if (\Auth::$current_user->isCreative()) { - $lockup->creative_feedback = $post_params['creative_feedback']; - $lockup->creative_status = Lockup::DENIED; - } else if (\Auth::$current_user->isApprover() && $lockup->approver_id == \Auth::$current_user->id) { - $lockup->communicator_feedback = $post_params['communicator_feedback']; - $lockup->status = Lockup::DENIED; - } - $lockup->save(); - - # send an email - $body = ' + Emailer::sendMail($lockup->user->email, "Lockup Feedback Given", $body); + + \Core::redirect($lockup->getPreviewURL()); + } + + public static function postDenyAction($post_params) { + self::requireAuth(); + + if (empty($post_params['id'])) { + \Core::notFound(); + } + + $id = $post_params['id']; + try { + $lockup = Lockup::find($id); + } catch (\ActiveRecord\RecordNotFound $e) { + \Core::notFound('That lockup could not be found.'); + } + + if (\Auth::$current_user->isAdmin()) { + $lockup->status = Lockup::DENIED; + $lockup->creative_status = Lockup::DENIED; + $lockup->creative_feedback = $post_params['creative_feedback']; + $lockup->communicator_feedback = $post_params['communicator_feedback']; + } else if (\Auth::$current_user->isCreative()) { + $lockup->creative_feedback = $post_params['creative_feedback']; + $lockup->creative_status = Lockup::DENIED; + } else if (\Auth::$current_user->isApprover() && $lockup->approver_id == \Auth::$current_user->id) { + $lockup->communicator_feedback = $post_params['communicator_feedback']; + $lockup->status = Lockup::DENIED; + } + $lockup->save(); + + # send an email + $body = ' Your lockup, ' . $lockup->getName() . ', has been denied. <br><br> Please visit <a href="http://lockups.unl.edu' . $lockup->getPreviewURL() . '">http://lockups.unl.edu' . $lockup->getPreviewURL() . '</a> to view your lockup, and edit it if necessary. @@ -526,334 +532,334 @@ If you can\'t see your lockups or if there are issues with any versions, please <br><br> UNL Lockup Factory'; - Emailer::sendMail($lockup->user->email, "Lockup Denied", $body); + Emailer::sendMail($lockup->user->email, "Lockup Denied", $body); - \Core::redirect($lockup->getPreviewURL()); - } + \Core::redirect($lockup->getPreviewURL()); + } - public static function postGenerateAction($post_params) { - self::requireAuth(); + public static function postGenerateAction($post_params) { + self::requireAuth(); - if (empty($post_params['id'])) { - \Core::notFound(); - } + if (empty($post_params['id'])) { + \Core::notFound(); + } - $id = $post_params['id']; - try { - $lockup_model = Lockup::find($id); - } catch (\ActiveRecord\RecordNotFound $e) { - \Core::notFound('That lockup could not be found.'); - } - - # need to check that this is not already generated - if ($lockup_model->isGenerated()) { - \Core::notFound('That lockup has already been generated.'); - } - - $frontend_output = $lockup_model->createAllVersions(); - self::storeGenerateOutput(join('
 
', $frontend_output)); - - $lockup_model->status = Lockup::GENERATED; - $lockup_model->creative_status = Lockup::GENERATED; - $lockup_model->version = self::LOCKUP_VERSION; - - if (array_key_exists('publish_lockup', $post_params) && $post_params['publish_lockup'] == 'on') { - $lockup_model->published = TRUE; - } else { - $lockup_model->published = FALSE; - } - - $lockup_model->save(); - - \Core::redirect($lockup_model->getDownloadURL()); - } - - public static function postRegenerateAction($post_params) { - self::requireAuth(); - - if (empty($post_params['id'])) { - \Core::notFound(); - } - - $id = $post_params['id']; - try { - $lockup_model = Lockup::find($id); - } catch (\ActiveRecord\RecordNotFound $e) { - \Core::notFound('That lockup could not be found.'); - } - - # remove all lockup files from this lockup - foreach ($lockup_model->files as $file) { - $file->delete(); - } - - # then run the generate functionality again - $frontend_output = $lockup_model->createAllVersions(); - self::storeGenerateOutput(join('
 
', $frontend_output)); - - $lockup_model->version = self::LOCKUP_VERSION; - $lockup_model->save(); - - \Core::redirect($lockup_model->getDownloadURL()); - } - - public static function downloadAction($get_params) { - self::requireAuth(); - \Core::$breadcrumbs[] = array('text' => 'Lockup Details and Files'); - - if (empty($get_params['id'])) { - \Core::notFound(); - } - $id = $get_params['id']; - try { - $select_fields = 'id, organization, subject, organization_second_line, subject_second_line, acronym, acronym_subject, extension_county, - style, user_id, date_created, status, approver_id, file_organization, file_organization_acronym, file_department, file_department_acronym, - creative_status, creative_feedback, communicator_feedback, version, acronym_second_line, published'; - $lockup = Lockup::find($id, array('select' => $select_fields, 'include' => array('user'))); - - $files_fields = 'id, lockup_id, orientation, color, reverse, type'; - $files = LockupFile::all(array('select' => $files_fields, 'conditions' => array('lockup_id' => $id))); - - } catch (\ActiveRecord\RecordNotFound $e) { - \Core::notFound('That lockup could not be found.'); - } - - if ($lockup->published == FALSE && $lockup->user_id != \Auth::$current_user->id) { - \Core::notFound('That lockup is private.'); - } - - $context = new \stdClass; - $context->lockup = $lockup; - $context->files = $files; - - if ($lockup->version != self::LOCKUP_VERSION) { - return self::renderView('regenerate', $context); - } - - return self::renderView('download_lockup_files', $context); - } - - public static function manageAction($get_params) { - self::requireAuth(); - \Core::$breadcrumbs[] = array('text' => 'Manage Lockups'); - - $page_size = 10; - $all_page = 1; - $all_offset = 0; - $my_page = 1; - $my_offset = 0; - $approver_page = 1; - $approver_offset = 0; - $creative_page = 1; - $creative_offset = 0; - if (array_key_exists('all_page', $get_params)) { - if ((int)($get_params['all_page']) >= 1) { - $all_page = (int)($get_params['all_page']); - $all_offset = ($all_page - 1) * $page_size; - } - } - - if (array_key_exists('page', $get_params)) { - if ((int)($get_params['page']) >= 1) { - $my_page = (int)($get_params['page']); - $my_offset = ($my_page - 1) * $page_size; - } - } - - if (array_key_exists('approver_page', $get_params)) { - if ((int)($get_params['approver_page']) >= 1) { - $approver_page = (int)($get_params['approver_page']); - $approver_offset = ($approver_page - 1) * $page_size; - } - } - - if (array_key_exists('creative_page', $get_params)) { - if ((int)($get_params['creative_page']) >= 1) { - $creative_page = (int)($get_params['creative_page']); - $creative_offset = ($creative_page - 1) * $page_size; - } - } - - $select_fields = 'id, organization, subject, organization_second_line, subject_second_line, acronym, acronym_subject, extension_county, - style, user_id, date_created, status, approver_id, file_organization, file_organization_acronym, file_department, file_department_acronym, - creative_status, creative_feedback, communicator_feedback, version, acronym_second_line, published'; - $all_options = array('select' => $select_fields, 'include' => array('user'), 'offset' => $all_offset, 'limit' => $page_size); - $my_options = array('select' => $select_fields, 'include' => array('user'), 'offset' => $my_offset, 'limit' => $page_size, - 'conditions' => array('user_id = ?', \Auth::$current_user->id)); - $approver_options = array('select' => $select_fields, 'offset' => $approver_offset, 'limit' => $page_size, - 'conditions' => array('approver_id = ? AND status in (?)', \Auth::$current_user->id, array('awaiting_approval', 'feedback_given'))); - $creative_options = array('select' => $select_fields, 'offset' => $creative_offset, 'limit' => $page_size, - 'conditions' => array('creative_status in (?)', array('awaiting_approval', 'feedback_given'))); - - $search_term = array_key_exists('search_term', $get_params) ? $get_params['search_term'] : NULL; - $search_sql_string = '(organization LIKE ? OR subject LIKE ? OR organization_second_line LIKE ? OR subject_second_line LIKE ? OR - acronym LIKE ? OR acronym_second_line LIKE ? OR acronym_subject LIKE ? OR extension_county LIKE ?)'; - $search_array = array('%'.$search_term.'%','%'.$search_term.'%','%'.$search_term.'%','%'.$search_term.'%','%'.$search_term.'%', - '%'.$search_term.'%','%'.$search_term.'%','%'.$search_term.'%'); - - if (!empty($search_term)) { - $all_options['conditions'] = array_merge(array($search_sql_string), $search_array); - $my_options['conditions'][0] = $my_options['conditions'][0] . ' AND ' . $search_sql_string; - $my_options['conditions'] = array_merge($my_options['conditions'], $search_array); - $approver_options['conditions'][0] = $approver_options['conditions'][0] . ' AND ' . $search_sql_string; - $approver_options['conditions'] = array_merge($approver_options['conditions'], $search_array); - $creative_options['conditions'][0] = $creative_options['conditions'][0] . ' AND ' . $search_sql_string; - $creative_options['conditions'] = array_merge($creative_options['conditions'], $search_array); - } - - $context = new \stdClass; - $context->all_lockups = Lockup::all($all_options); - unset($all_options['offset']); - unset($all_options['limit']); - unset($all_options['include']); - $context->all_count = Lockup::count($all_options); - $context->all_page = $all_page; - - $context->my_lockups = Lockup::all($my_options); - unset($my_options['offset']); - unset($my_options['limit']); - unset($my_options['include']); - $context->my_count = Lockup::count($my_options); - $context->my_page = $my_page; - - $context->approver_lockups = Lockup::all($approver_options); - unset($approver_options['offset']); - unset($approver_options['limit']); - unset($approver_options['include']); - $context->approver_count = Lockup::count($approver_options); - $context->approver_page = $approver_page; - - $context->creative_approval_lockups = Lockup::all($creative_options); - unset($creative_options['offset']); - unset($creative_options['limit']); - unset($creative_options['include']); - $context->creative_count = Lockup::count($creative_options); - $context->creative_page = $creative_page; - - $context->page_size = $page_size; - $context->search_term = $search_term; - - return self::renderView('manage_lockups', $context); - } - - public static function postDeleteAction($post_params) { - self::requireAuth(); - - if (empty($post_params['id'])) { - \Core::notFound(); - } - - $id = $post_params['id']; - try { - $lockup = Lockup::find($id); - } catch (\ActiveRecord\RecordNotFound $e) { - \Core::notFound('That lockup could not be found.'); - } - - # the user must have submitted the lockup or be an admin to delete - if ($lockup->user_id != \Auth::$current_user->id && !(\Auth::$current_user->isAdmin())) { - self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Unauthorized', 'Sorry, you are not allowed to delete that lockup.'); - \Core::redirect('/lockups/manage/'); - } - - $lockup->delete(); - self::flashNotice(parent::NOTICE_LEVEL_SUCCESS, 'Lockup deleted', 'That lockup has been deleted.'); - \Core::redirect('/lockups/manage/'); - } - - public static function postPublishAction($post_params) { - self::requireAuth(); - - if (empty($post_params['id'])) { - \Core::notFound(); - } - - $id = $post_params['id']; - try { - $lockup_model = Lockup::find($id); - } catch (\ActiveRecord\RecordNotFound $e) { - \Core::notFound('That lockup could not be found.'); - } - - # the user must have submitted the lockup or be an admin to publish - if ($lockup_model->user_id != \Auth::$current_user->id && !(\Auth::$current_user->isAdmin())) { - self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Unauthorized', 'Sorry, you are not allowed to publish that lockup.'); - \Core::redirect('/lockups/manage/'); - } - - $lockup_model->published = TRUE; - $lockup_model->save(); - - self::flashNotice(parent::NOTICE_LEVEL_SUCCESS, 'Lockup Published', 'Your lockup ' . $lockup_model->getName() . ' has been published to the Lockup Library.'); - \Core::redirect('/lockups/manage/'); - } - - public static function postUnpublishAction($post_params) { - self::requireAuth(); - - if (empty($post_params['id'])) { - \Core::notFound(); - } - - $id = $post_params['id']; - try { - $lockup_model = Lockup::find($id); - } catch (\ActiveRecord\RecordNotFound $e) { - \Core::notFound('That lockup could not be found.'); - } - - # the user must have submitted the lockup or be an admin to publish - if ($lockup_model->user_id != \Auth::$current_user->id && !(\Auth::$current_user->isAdmin())) { - self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Unauthorized', 'Sorry, you are not allowed to unpublish that lockup.'); - \Core::redirect('/lockups/manage/'); - } - - $lockup_model->published = FALSE; - $lockup_model->save(); - - self::flashNotice(parent::NOTICE_LEVEL_SUCCESS, 'Lockup Unpublished', 'Your lockup ' . $lockup_model->getName() . ' has been removed from the Lockup Library.'); - \Core::redirect('/lockups/manage/'); - } - - public static function libraryAction($get_params) { - self::requireAuth(); - \Core::$breadcrumbs[] = array('text' => 'Lockup Library'); - $context = new \stdClass; - - $all_options = array('conditions' => array('status' => Lockup::GENERATED, 'published' => TRUE), 'include' => array('user', 'approver')); - - $search_term = array_key_exists('search_term', $get_params) ? $get_params['search_term'] : NULL; - $search_sql_string = '(organization LIKE ? OR subject LIKE ? OR organization_second_line LIKE ? OR subject_second_line LIKE ? OR - acronym LIKE ? OR acronym_second_line LIKE ? OR acronym_subject LIKE ? OR extension_county LIKE ?)'; - $search_array = array(Lockup::GENERATED,'%'.$search_term.'%','%'.$search_term.'%','%'.$search_term.'%','%'.$search_term.'%','%'.$search_term.'%', - '%'.$search_term.'%','%'.$search_term.'%','%'.$search_term.'%'); - - if (!empty($search_term)) { - $all_options['conditions'] = array_merge(array('status = ? AND published = 1 AND ' . $search_sql_string), $search_array); - } - - $context->search_term = $search_term; - $lockups = Lockup::all($all_options); - - $context->lockups = array(); - foreach ($lockups as $lockup) { - # find the chunk it should be in - $chunk_id = $lockup->approver_id; - if ($chunk_id === NULL) { - $chunk_id = ''; - } - - # create if not exists - if (!array_key_exists($chunk_id, $context->lockups)) { - $context->lockups[$chunk_id] = array(); - } - - # append - $context->lockups[$chunk_id][] = $lockup; - } - - - return self::renderView('lockup_library', $context); - } + $id = $post_params['id']; + try { + $lockup_model = Lockup::find($id); + } catch (\ActiveRecord\RecordNotFound $e) { + \Core::notFound('That lockup could not be found.'); + } + + # need to check that this is not already generated + if ($lockup_model->isGenerated()) { + \Core::notFound('That lockup has already been generated.'); + } + + $frontend_output = $lockup_model->createAllVersions(); + self::storeGenerateOutput(join('
 
', $frontend_output)); + + $lockup_model->status = Lockup::GENERATED; + $lockup_model->creative_status = Lockup::GENERATED; + $lockup_model->version = self::LOCKUP_VERSION; + + if (array_key_exists('publish_lockup', $post_params) && $post_params['publish_lockup'] == 'on') { + $lockup_model->published = TRUE; + } else { + $lockup_model->published = FALSE; + } + + $lockup_model->save(); + + \Core::redirect($lockup_model->getDownloadURL()); + } + + public static function postRegenerateAction($post_params) { + self::requireAuth(); + + if (empty($post_params['id'])) { + \Core::notFound(); + } + + $id = $post_params['id']; + try { + $lockup_model = Lockup::find($id); + } catch (\ActiveRecord\RecordNotFound $e) { + \Core::notFound('That lockup could not be found.'); + } + + # remove all lockup files from this lockup + foreach ($lockup_model->files as $file) { + $file->delete(); + } + + # then run the generate functionality again + $frontend_output = $lockup_model->createAllVersions(); + self::storeGenerateOutput(join('
 
', $frontend_output)); + + $lockup_model->version = self::LOCKUP_VERSION; + $lockup_model->save(); + + \Core::redirect($lockup_model->getDownloadURL()); + } + + public static function downloadAction($get_params) { + self::requireAuth(); + \Core::$breadcrumbs[] = array('text' => 'Lockup Details and Files'); + + if (empty($get_params['id'])) { + \Core::notFound(); + } + $id = $get_params['id']; + try { + $select_fields = 'id, organization, subject, organization_second_line, subject_second_line, acronym, acronym_subject, extension_county, + style, user_id, date_created, status, approver_id, file_organization, file_organization_acronym, file_department, file_department_acronym, + creative_status, creative_feedback, communicator_feedback, version, acronym_second_line, published'; + $lockup = Lockup::find($id, array('select' => $select_fields, 'include' => array('user'))); + + $files_fields = 'id, lockup_id, orientation, color, reverse, type'; + $files = LockupFile::all(array('select' => $files_fields, 'conditions' => array('lockup_id' => $id))); + + } catch (\ActiveRecord\RecordNotFound $e) { + \Core::notFound('That lockup could not be found.'); + } + + if ($lockup->published == FALSE && $lockup->user_id != \Auth::$current_user->id) { + \Core::notFound('That lockup is private.'); + } + + $context = new \stdClass; + $context->lockup = $lockup; + $context->files = $files; + + if ($lockup->version != self::LOCKUP_VERSION) { + return self::renderView('regenerate', $context); + } + + return self::renderView('download_lockup_files', $context); + } + + public static function manageAction($get_params) { + self::requireAuth(); + \Core::$breadcrumbs[] = array('text' => 'Manage Lockups'); + + $page_size = 10; + $all_page = 1; + $all_offset = 0; + $my_page = 1; + $my_offset = 0; + $approver_page = 1; + $approver_offset = 0; + $creative_page = 1; + $creative_offset = 0; + if (array_key_exists('all_page', $get_params)) { + if ((int)($get_params['all_page']) >= 1) { + $all_page = (int)($get_params['all_page']); + $all_offset = ($all_page - 1) * $page_size; + } + } + + if (array_key_exists('page', $get_params)) { + if ((int)($get_params['page']) >= 1) { + $my_page = (int)($get_params['page']); + $my_offset = ($my_page - 1) * $page_size; + } + } + + if (array_key_exists('approver_page', $get_params)) { + if ((int)($get_params['approver_page']) >= 1) { + $approver_page = (int)($get_params['approver_page']); + $approver_offset = ($approver_page - 1) * $page_size; + } + } + + if (array_key_exists('creative_page', $get_params)) { + if ((int)($get_params['creative_page']) >= 1) { + $creative_page = (int)($get_params['creative_page']); + $creative_offset = ($creative_page - 1) * $page_size; + } + } + + $select_fields = 'id, organization, subject, organization_second_line, subject_second_line, acronym, acronym_subject, extension_county, + style, user_id, date_created, status, approver_id, file_organization, file_organization_acronym, file_department, file_department_acronym, + creative_status, creative_feedback, communicator_feedback, version, acronym_second_line, published'; + $all_options = array('select' => $select_fields, 'include' => array('user'), 'offset' => $all_offset, 'limit' => $page_size); + $my_options = array('select' => $select_fields, 'include' => array('user'), 'offset' => $my_offset, 'limit' => $page_size, + 'conditions' => array('user_id = ?', \Auth::$current_user->id)); + $approver_options = array('select' => $select_fields, 'offset' => $approver_offset, 'limit' => $page_size, + 'conditions' => array('approver_id = ? AND status in (?)', \Auth::$current_user->id, array('awaiting_approval', 'feedback_given'))); + $creative_options = array('select' => $select_fields, 'offset' => $creative_offset, 'limit' => $page_size, + 'conditions' => array('creative_status in (?)', array('awaiting_approval', 'feedback_given'))); + + $search_term = array_key_exists('search_term', $get_params) ? $get_params['search_term'] : NULL; + $search_sql_string = '(organization LIKE ? OR subject LIKE ? OR organization_second_line LIKE ? OR subject_second_line LIKE ? OR + acronym LIKE ? OR acronym_second_line LIKE ? OR acronym_subject LIKE ? OR extension_county LIKE ?)'; + $search_array = array('%'.$search_term.'%','%'.$search_term.'%','%'.$search_term.'%','%'.$search_term.'%','%'.$search_term.'%', + '%'.$search_term.'%','%'.$search_term.'%','%'.$search_term.'%'); + + if (!empty($search_term)) { + $all_options['conditions'] = array_merge(array($search_sql_string), $search_array); + $my_options['conditions'][0] = $my_options['conditions'][0] . ' AND ' . $search_sql_string; + $my_options['conditions'] = array_merge($my_options['conditions'], $search_array); + $approver_options['conditions'][0] = $approver_options['conditions'][0] . ' AND ' . $search_sql_string; + $approver_options['conditions'] = array_merge($approver_options['conditions'], $search_array); + $creative_options['conditions'][0] = $creative_options['conditions'][0] . ' AND ' . $search_sql_string; + $creative_options['conditions'] = array_merge($creative_options['conditions'], $search_array); + } + + $context = new \stdClass; + $context->all_lockups = Lockup::all($all_options); + unset($all_options['offset']); + unset($all_options['limit']); + unset($all_options['include']); + $context->all_count = Lockup::count($all_options); + $context->all_page = $all_page; + + $context->my_lockups = Lockup::all($my_options); + unset($my_options['offset']); + unset($my_options['limit']); + unset($my_options['include']); + $context->my_count = Lockup::count($my_options); + $context->my_page = $my_page; + + $context->approver_lockups = Lockup::all($approver_options); + unset($approver_options['offset']); + unset($approver_options['limit']); + unset($approver_options['include']); + $context->approver_count = Lockup::count($approver_options); + $context->approver_page = $approver_page; + + $context->creative_approval_lockups = Lockup::all($creative_options); + unset($creative_options['offset']); + unset($creative_options['limit']); + unset($creative_options['include']); + $context->creative_count = Lockup::count($creative_options); + $context->creative_page = $creative_page; + + $context->page_size = $page_size; + $context->search_term = $search_term; + + return self::renderView('manage_lockups', $context); + } + + public static function postDeleteAction($post_params) { + self::requireAuth(); + + if (empty($post_params['id'])) { + \Core::notFound(); + } + + $id = $post_params['id']; + try { + $lockup = Lockup::find($id); + } catch (\ActiveRecord\RecordNotFound $e) { + \Core::notFound('That lockup could not be found.'); + } + + # the user must have submitted the lockup or be an admin to delete + if ($lockup->user_id != \Auth::$current_user->id && !(\Auth::$current_user->isAdmin())) { + self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Unauthorized', 'Sorry, you are not allowed to delete that lockup.'); + \Core::redirect('/lockups/manage/'); + } + + $lockup->delete(); + self::flashNotice(parent::NOTICE_LEVEL_SUCCESS, 'Lockup deleted', 'That lockup has been deleted.'); + \Core::redirect('/lockups/manage/'); + } + + public static function postPublishAction($post_params) { + self::requireAuth(); + + if (empty($post_params['id'])) { + \Core::notFound(); + } + + $id = $post_params['id']; + try { + $lockup_model = Lockup::find($id); + } catch (\ActiveRecord\RecordNotFound $e) { + \Core::notFound('That lockup could not be found.'); + } + + # the user must have submitted the lockup or be an admin to publish + if ($lockup_model->user_id != \Auth::$current_user->id && !(\Auth::$current_user->isAdmin())) { + self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Unauthorized', 'Sorry, you are not allowed to publish that lockup.'); + \Core::redirect('/lockups/manage/'); + } + + $lockup_model->published = TRUE; + $lockup_model->save(); + + self::flashNotice(parent::NOTICE_LEVEL_SUCCESS, 'Lockup Published', 'Your lockup ' . $lockup_model->getName() . ' has been published to the Lockup Library.'); + \Core::redirect('/lockups/manage/'); + } + + public static function postUnpublishAction($post_params) { + self::requireAuth(); + + if (empty($post_params['id'])) { + \Core::notFound(); + } + + $id = $post_params['id']; + try { + $lockup_model = Lockup::find($id); + } catch (\ActiveRecord\RecordNotFound $e) { + \Core::notFound('That lockup could not be found.'); + } + + # the user must have submitted the lockup or be an admin to publish + if ($lockup_model->user_id != \Auth::$current_user->id && !(\Auth::$current_user->isAdmin())) { + self::flashNotice(parent::NOTICE_LEVEL_ERROR, 'Unauthorized', 'Sorry, you are not allowed to unpublish that lockup.'); + \Core::redirect('/lockups/manage/'); + } + + $lockup_model->published = FALSE; + $lockup_model->save(); + + self::flashNotice(parent::NOTICE_LEVEL_SUCCESS, 'Lockup Unpublished', 'Your lockup ' . $lockup_model->getName() . ' has been removed from the Lockup Library.'); + \Core::redirect('/lockups/manage/'); + } + + public static function libraryAction($get_params) { + self::requireAuth(); + \Core::$breadcrumbs[] = array('text' => 'Lockup Library'); + $context = new \stdClass; + + $all_options = array('conditions' => array('status' => Lockup::GENERATED, 'published' => TRUE), 'include' => array('user', 'approver')); + + $search_term = array_key_exists('search_term', $get_params) ? $get_params['search_term'] : NULL; + $search_sql_string = '(organization LIKE ? OR subject LIKE ? OR organization_second_line LIKE ? OR subject_second_line LIKE ? OR + acronym LIKE ? OR acronym_second_line LIKE ? OR acronym_subject LIKE ? OR extension_county LIKE ?)'; + $search_array = array(Lockup::GENERATED,'%'.$search_term.'%','%'.$search_term.'%','%'.$search_term.'%','%'.$search_term.'%','%'.$search_term.'%', + '%'.$search_term.'%','%'.$search_term.'%','%'.$search_term.'%'); + + if (!empty($search_term)) { + $all_options['conditions'] = array_merge(array('status = ? AND published = 1 AND ' . $search_sql_string), $search_array); + } + + $context->search_term = $search_term; + $lockups = Lockup::all($all_options); + + $context->lockups = array(); + foreach ($lockups as $lockup) { + # find the chunk it should be in + $chunk_id = $lockup->approver_id; + if ($chunk_id === NULL) { + $chunk_id = ''; + } + + # create if not exists + if (!array_key_exists($chunk_id, $context->lockups)) { + $context->lockups[$chunk_id] = array(); + } + + # append + $context->lockups[$chunk_id][] = $lockup; + } + + + return self::renderView('lockup_library', $context); + } } diff --git a/src/SvgGenerator.php b/src/SvgGenerator.php index ecce93a0270a74d2d7966ff8edb328db2f6f22a9..184f9df9304298e1ea5e0fe7f15560c1b429592c 100644 --- a/src/SvgGenerator.php +++ b/src/SvgGenerator.php @@ -2,636 +2,674 @@ use Models\Lockup; class SvgGenerator { - const SCARLET = '#d00000'; - const WHITE = '#ffffff'; - const BLACK = '#000000'; - const PANTONE_RED = '#cf0a2c'; #pantone 186cp - const CMYK_RED = '#da1a32 device-cmyk(0.02, 1.00, 0.85, 0.06)'; - const FOUR_H_GREEN = '#129a63'; #pantone for this is 347U - - const TUNGSTEN = \Core::ROOT . '/src/SVGFonts/Tungsten-Semibold.svg'; - const MERCURY = \Core::ROOT . '/src/SVGFonts/MercuryDisplay-SemIta.svg'; - - const HORIZ_N_OUTLINE_R = "M37.27894812 34.48421122h.33157896c.14210526 0 .1894737 0 .26052632.04736842.09473684.04736842.14210526.14210526.14210526.26052632 0 .09473684-.0236842.16578948-.07105263.2368421-.0236842.04736843-.07105263.04736843-.14210526.09473685h-.02368422l.26052633.49736844h-.1894737l-.2368421-.47368422h-.14210527v.47368422h-.18947368v-1.13684212zm.28421054.49736843h.09473684c.09473684-.0236842.14210527-.07105264.14210527-.1894737 0-.07105262-.0236842-.11842105-.09473685-.14210526h-.23684211v.33157895h.09473686zM34.815789 0H20.842105v10.65789H23.210526v5.87369L13.073684.54474 12.742105 0H0v10.65789H2.368421v14.68422H0V36H15.157895V25.34211H12.789474v-5.87369l10.136842 15.98684.355263.54474H36V25.34211H33.631579V10.65789H36V0h-1.184211zm.710527 1.18421v9h-2.368421v15.63158h2.368421v9.71053H23.542105l-.213158-.33158-11.013158-17.36053v7.98158h2.368422v9.71053H.473684v-9.71053h2.368421V10.18421H.473684V.47368h11.984211l.213158.33158 11.013158 17.36053v-7.98158h-2.368422V.47368h14.210527v.71053z"; - const HORIZ_N_R_CIRCLE = "M37.681579 34.10526c-.544737 0-.971053.42632-.971053.94737S37.136842 36 37.657895 36c.521052 0 .947368-.42632.947368-.94737s-.426316-.94737-.923684-.94737zm-.02368 1.70527c-.426316 0-.757895-.33158-.757895-.7579 0-.42631.331579-.75789.757895-.75789.402631 0 .757894.35526.757894.75789 0 .42632-.331578.7579-.757894.7579z"; - const HORIZ_N_FILL = "M24.394737 20.60526L12.078947 1.18421H1.184211v8.28947h2.368421v17.05264H1.184211v8.28947h12.789473v-8.28947h-2.368421V15.39474l12.31579 19.42105h10.894736v-8.28947h-2.368421V9.47368h2.368421V1.18421H22.026316v8.28947h2.368421v11.13158z"; - const HORIZ_N_SERIF = "M37.657895 35.81053c-.426316 0-.757895-.33158-.757895-.7579 0-.42631.331579-.75789.757895-.75789.402631 0 .757894.35526.757894.75789 0 .42632-.331578.7579-.757894.7579z"; - const HORIZ_N_R_FILL = "M34.815789.47368h-13.5v9.71053h2.368422v7.98158L12.671053.80526l-.189474-.33158H.473684v9.71053h2.368421v15.63158H.473684v9.71053h14.210527v-9.71053h-2.368422v-7.98158l11.013158 17.36053.213158.33158h11.984211v-9.71053h-2.368421V10.18421h2.368421V.47368h-.710527zM13.973684 26.52632v8.28947H1.184211v-8.28947h2.368421V9.47368H1.184211V1.18421h10.894736l12.31579 19.42105V9.47368h-2.368421V1.18421h12.789473v8.28947h-2.368421v17.05264h2.368421v8.28947H23.921053l-12.31579-19.42105v11.13158h2.368421z"; - - const VERT_N_OUTLINE_R = "M119.27942132 34.48421092h.33157896c.14210526 0 .1894737 0 .26052632.04736842.09473684.04736842.14210526.14210526.14210526.26052632 0 .09473684-.0236842.16578948-.07105263.2368421-.0236842.04736843-.07105263.04736843-.14210526.09473685h-.02368422l.26052633.49736844h-.1894737l-.2368421-.47368422h-.14210527v.47368422h-.18947368v-1.13684212zm.28421054.49736843h.09473684c.09473684-.0236842.14210527-.07105264.14210527-.1894737 0-.07105262-.02368422-.11842105-.09473685-.14210526h-.23684211v.33157895h.09473686zM116.81579 0h-13.97368V10.65789h2.36842v5.87369L95.073684.5447397 94.742105 0H82V10.65789h2.368421v14.68422H82V36h15.157896V25.34211H94.789475v-5.87369l10.136845 15.98684.35526.54474H118V25.34211h-2.36842V10.65789H118V 0h-1.18421zm.71053 1.18421V10.18421h-2.36842v15.63158h2.36842v9.71053H105.54211l-.21316-.33158-11.013161-17.36053v7.98158h2.368422v9.71053H82.473684v-9.71053h2.368421V10.18421h-2.368421V.4736797h11.984211l.213158.33158L105.68421 18.16579v-7.98158h-2.36842V.4736797h14.21053v.71053z"; - const VERT_N_R_CIRCLE = "M119.68205 34.10526c-.54474 0-.97105.42632-.97105.94737s.42631.94737.94737.94737c.52105 0 .94736-.42632.94736-.94737s-.42631-.94737-.92368-.94737zm-.0237 1.70527c-.42632 0-.7579-.33158-.7579-.7579 0-.42631.33158-.75789.7579-.75789.40263 0 .75789.35526.75789.75789 0 .42632-.33157.7579-.75789.7579z"; - const VERT_N_FILL = "M106.39474 20.60526L94.078946 1.1842097H83.18421V9.47368h2.368421v17.05264H83.18421v8.28947h12.789473v-8.28947h-2.368421V15.39474l12.315788 19.42105h10.89474v-8.28947h-2.36842V9.47368h2.36842V1.1842097h-12.78947V9.47368h2.36842v11.13158z"; - const VERT_N_SERIF = "M119.65837 35.81053c-.42632 0-.7579-.33158-.7579-.7579 0-.42631.33158-.75789.7579-.75789.40263 0 .75789.35526.75789.75789 0 .42632-.33158.7579-.75789.7579z"; - const VERT_N_R_FILL = "M116.81579.4736797h-13.5V10.18421h2.36842v7.98158L94.67105.8052597l-.189474-.33158H82.473681V10.18421h2.368421v15.63158h-2.368421v9.71053h14.210527v-9.71053h-2.368422v-7.98158l11.013164 17.36053.21316.33158H117.52632v-9.71053h-2.36842V10.18421h2.36842V.4736797h-.71053zM95.973681 26.52632v8.28947H83.184208v-8.28947h2.368421V9.47368h-2.368421V1.1842097h10.894736L106.39474 20.60526V9.47368h-2.36843V1.1842097h12.78948V9.47368h-2.36842v17.05264h2.36842v8.28947h-10.89474L93.60526 15.39474v11.13158h2.368421z"; - const VERT_BACKGROUND = "M-100 -100 L300 -100 L300 100 L-100 100 Z"; - - const LEFT_N_R_FILL = "M42.79 36.46 a .76 .76 0 1 0 1.52 0 .76 .76 0 1 0 -1.52 0"; - const LEFT_N_R_CIRCLE = "M42.79 36.46 a .76 .76 0 1 0 1.52 0 .76 .76 0 1 0 -1.52 0 m -.19 0 a .95 .95 0 1 0 1.9 0 .95 .95 0 1 0 -1.9 0"; - const LEFT_N_OUTLINE_R = "M43.46 36.39h.09a.17 .17,0,0,0,.14 -.18 .13 .13,0,0,0 -.09 -.14h -.24v.34Zm-.29 -.5h.33a.54 .54,0,0,1,.25,0,.29 .29,0,0,1,.15 .27 .34 .34,0,0,1 -.08 .23 .37 .37,0,0,1 -.13 .09h0l .26 .51h -.19l -.25 -.48h -.13V37h -.19Z"; - const LEFT_N_OUTLINE = "M41.42,2.6v9H39V27.23h2.37v9.71h-12l-.21-.33-11-17.35v8h2.37v9.71H6.37V27.23H8.73V11.6H6.37V1.89h12l.21.33,11,17.35v-8H27.21V1.89H41.42Zm-.71-1.18h-14V12.07H29.1v5.87L19,2l-.35-.55H5.89V12.07H8.26V26.75H5.89V37.41H21V26.75H18.68V20.89l10.13,16,.35.55H41.89V26.75H39.52V12.07h2.37V1.41Z"; - const LEFT_N_SERIF = "M19.87,27.94h0v8.29H7.08V27.94H9.44V10.89H7.08V2.6H18L30.29,22V10.89H27.92V2.6H40.71v8.29H38.34V27.94h2.37v8.29H29.81L17.5,16.81V27.94ZM40.71,1.89H27.21V11.6h2.37v8l-11-17.36-.21-.33h-12V11.6H8.73V27.23H6.37v9.71H20.58V27.23H18.21v-8l11,17.35.21.33h12V27.23H39V11.6h2.37V1.89Z"; - const LEFT_N_FILL = "M24.75,22.12L24.75 22.12 12.43 2.7 1.54 2.7 1.54 10.99 3.91 10.99 3.91 28.04 1.54 28.04 1.54 36.33 14.33 36.33 14.33 28.04 11.96 28.04 11.96 16.91 24.28 36.33 35.17 36.33 35.17 28.04 32.8 28.04 32.8 10.99 35.17 10.99 35.17 2.7 22.38 2.7 22.38 10.99 24.75 10.99 24.75 22.12z"; - - const RIGHT_CLOVER_FILL = "M 0,0 C 0.043,-1.596 -0.626,-2.857 -1.375,-3.591 -1.853,-4.06 -2.473,-4.264 -2.961,-4.647 -3.408,-4.998 -3.925,-5.511 -4.23,-6.073 -4.515,-6.598 -4.55,-7.139 -4.759,-7.552 -5.232,-8.487 -6.088,-9.297 -7.138,-9.77 c -2.089,-0.941 -4.443,0.226 -5.552,1.214 -0.81,0.723 -1.752,1.868 -2.221,3.011 -0.528,1.286 -0.877,3.177 -1.163,4.858 -0.067,0.392 -0.169,1.387 -0.529,1.426 -0.983,0.108 -0.542,-3.036 -0.476,-3.855 0.361,-4.453 1.786,-7.509 3.701,-10.087 l -3.331,0 c -1.722,2.837 -2.364,7.326 -2.009,12.2 0.046,0.631 0.162,1.617 -0.159,1.742 -0.65,0.255 -0.712,-0.845 -0.793,-1.267 -0.297,-1.566 -0.58,-3.64 -1.11,-4.964 -0.799,-1.998 -3.091,-4.355 -5.552,-4.595 -2.255,-0.22 -3.885,1.121 -4.6,2.482 -0.226,0.429 -0.306,0.975 -0.582,1.479 -0.297,0.542 -0.738,1.074 -1.163,1.426 -0.416,0.343 -0.92,0.491 -1.322,0.792 -0.846,0.631 -2.202,2.448 -1.692,4.383 0.235,0.892 1.119,2.31 1.745,2.905 0.889,0.846 2.278,1.807 3.754,2.112 1.61,0.333 4.377,0.159 6.345,0.159 0.62,0 1.616,-0.154 1.692,0.37 0.091,0.63 -1.038,0.65 -1.692,0.686 -1.976,0.109 -4.881,0.089 -6.504,0.634 -2.352,0.79 -4.811,3.171 -4.811,5.968 0,1.353 0.568,2.431 1.322,3.168 0.776,0.761 1.72,1.021 2.485,1.532 1.433,0.957 1.626,2.374 2.644,3.433 0.692,0.719 1.947,1.441 3.225,1.479 1.798,0.052 3.119,-0.757 4.071,-1.532 0.627,-0.51 1.209,-1.28 1.692,-2.007 1.239,-1.866 1.069,-4.991 1.269,-7.922 0.042,-0.61 0.159,-1.214 0.582,-1.214 0.629,0 0.62,1.637 0.634,1.901 0.126,2.351 0.224,5.139 0.899,6.601 0.964,2.085 3.215,4.143 5.817,4.173 1.671,0.018 2.982,-0.766 3.807,-1.849 0.744,-0.977 1.171,-2.393 2.432,-3.169 0.851,-0.523 1.823,-0.836 2.485,-1.531 1.507,-1.584 1.5,-4.436 0.106,-6.285 -1.041,-1.381 -2.84,-2.712 -5.076,-3.01 -1.321,-0.176 -3.923,-0.343 -5.605,-0.423 -0.675,-0.032 -1.457,-0.03 -1.428,-0.581 0.032,-0.594 1.062,-0.422 1.692,-0.422 3.1,0 6.263,0.202 8.249,-0.792 C -1.874,3.865 -0.431,2.073 0,0"; - const RIGHT_CLOVER_LETTER_1 = "M 0,0 -0.128,-0.168 -0.761,0.316 C -0.751,0.211 -0.764,0.106 -0.8,0.002 l -0.152,0.117 c 0.019,0.054 0.028,0.123 0.028,0.204 -0.001,0.082 -0.021,0.153 -0.059,0.213 L -0.879,0.671 0,0 Z"; - const RIGHT_CLOVER_LETTER_2 = "m 0,0 c -0.052,-0.029 -0.101,-0.042 -0.148,-0.037 -0.047,0.005 -0.09,0.022 -0.128,0.051 -0.065,0.05 -0.102,0.114 -0.109,0.192 -0.008,0.078 0.02,0.159 0.084,0.243 0.064,0.083 0.135,0.132 0.213,0.145 C -0.011,0.607 0.061,0.589 0.126,0.539 0.167,0.508 0.195,0.47 0.21,0.425 0.226,0.38 0.227,0.332 0.215,0.281 0.271,0.314 0.328,0.329 0.385,0.326 0.442,0.322 0.495,0.302 0.544,0.265 0.625,0.203 0.671,0.127 0.682,0.037 0.693,-0.054 0.666,-0.141 0.601,-0.227 0.54,-0.306 0.468,-0.357 0.386,-0.377 0.289,-0.402 0.197,-0.381 0.111,-0.316 0.064,-0.279 0.029,-0.234 0.007,-0.181 -0.015,-0.127 -0.017,-0.067 0,0 m -0.142,0.163 c 0.033,-0.025 0.066,-0.036 0.1,-0.031 0.033,0.004 0.062,0.022 0.086,0.054 0.024,0.032 0.034,0.065 0.03,0.098 C 0.07,0.318 0.051,0.347 0.017,0.373 -0.014,0.397 -0.047,0.407 -0.08,0.402 -0.114,0.398 -0.142,0.38 -0.166,0.349 -0.191,0.317 -0.201,0.284 -0.196,0.25 -0.192,0.216 -0.174,0.187 -0.142,0.163 m 0.363,-0.301 c 0.046,-0.036 0.091,-0.052 0.135,-0.048 0.045,0.004 0.08,0.024 0.107,0.059 0.027,0.035 0.036,0.073 0.029,0.115 C 0.484,0.03 0.457,0.069 0.41,0.105 0.368,0.136 0.326,0.15 0.284,0.146 0.241,0.142 0.206,0.122 0.179,0.087 0.147,0.046 0.138,0.004 0.151,-0.038 c 0.013,-0.041 0.036,-0.075 0.07,-0.1"; - const RIGHT_CLOVER_LETTER_3 = "m 0,0 0.135,0.176 0.474,-0.361 c 0.075,-0.058 0.125,-0.093 0.151,-0.105 0.042,-0.02 0.084,-0.024 0.128,-0.012 0.043,0.012 0.084,0.042 0.121,0.091 0.039,0.05 0.057,0.096 0.056,0.137 C 1.064,-0.033 1.051,0.002 1.025,0.03 0.999,0.058 0.952,0.098 0.882,0.151 L 0.399,0.52 0.534,0.697 0.993,0.346 C 1.098,0.266 1.169,0.204 1.205,0.161 1.241,0.119 1.264,0.073 1.274,0.025 1.285,-0.024 1.282,-0.076 1.267,-0.133 1.252,-0.189 1.218,-0.252 1.165,-0.321 1.101,-0.404 1.043,-0.46 0.991,-0.489 0.938,-0.517 0.887,-0.532 0.837,-0.533 0.787,-0.535 0.742,-0.527 0.702,-0.509 0.643,-0.482 0.565,-0.431 0.467,-0.356 L 0,0 Z"; - const RIGHT_CLOVER_LETTER_4 = "M 0,0 0.115,0.184 C 0.181,0.151 0.239,0.139 0.291,0.151 0.342,0.161 0.388,0.194 0.43,0.248 0.473,0.305 0.494,0.357 0.492,0.404 0.49,0.452 0.473,0.488 0.441,0.512 0.42,0.528 0.398,0.535 0.374,0.535 0.35,0.533 0.321,0.522 0.288,0.5 0.265,0.485 0.216,0.447 0.141,0.388 0.045,0.311 -0.035,0.266 -0.098,0.254 c -0.09,-0.017 -0.169,0.001 -0.238,0.054 -0.045,0.034 -0.077,0.079 -0.096,0.134 -0.02,0.055 -0.021,0.114 -0.005,0.177 0.016,0.063 0.049,0.128 0.101,0.195 0.084,0.11 0.171,0.174 0.262,0.193 C 0.017,1.025 0.104,1.005 0.187,0.946 L 0.058,0.764 C 0.007,0.791 -0.038,0.8 -0.076,0.79 -0.115,0.78 -0.154,0.751 -0.192,0.701 -0.231,0.649 -0.251,0.601 -0.252,0.556 -0.253,0.527 -0.242,0.503 -0.22,0.486 -0.199,0.47 -0.174,0.465 -0.146,0.472 -0.11,0.48 -0.049,0.519 0.037,0.589 0.123,0.66 0.193,0.707 0.246,0.732 0.299,0.757 0.354,0.766 0.409,0.761 0.465,0.755 0.52,0.732 0.576,0.689 0.626,0.651 0.662,0.601 0.685,0.54 0.707,0.478 0.709,0.414 0.692,0.347 0.674,0.28 0.636,0.208 0.578,0.132 0.493,0.021 0.402,-0.045 0.305,-0.065 0.209,-0.085 0.107,-0.063 0,0"; - const RIGHT_CLOVER_LETTER_5 = "m 0,0 0.185,0.13 c 0.076,-0.1 0.114,-0.198 0.114,-0.295 0,-0.096 -0.036,-0.191 -0.108,-0.285 -0.089,-0.116 -0.201,-0.181 -0.338,-0.195 -0.136,-0.015 -0.274,0.031 -0.411,0.136 -0.146,0.111 -0.23,0.235 -0.253,0.372 -0.023,0.136 0.012,0.266 0.106,0.388 0.082,0.107 0.18,0.17 0.294,0.188 0.068,0.011 0.145,0 0.23,-0.034 L -0.273,0.199 C -0.326,0.223 -0.378,0.229 -0.43,0.216 -0.481,0.203 -0.525,0.174 -0.561,0.127 -0.61,0.062 -0.627,-0.008 -0.612,-0.084 c 0.016,-0.076 0.076,-0.153 0.18,-0.233 0.11,-0.084 0.204,-0.124 0.281,-0.12 0.078,0.003 0.141,0.037 0.19,0.101 0.035,0.047 0.051,0.098 0.047,0.155 C 0.082,-0.124 0.053,-0.064 0,0"; - const RIGHT_CLOVER_LETTER_6 = "M 0,0 -0.156,0.119 0.283,0.692 0.404,0.599 C 0.415,0.516 0.445,0.417 0.495,0.301 0.544,0.186 0.608,0.078 0.687,-0.023 0.765,-0.124 0.844,-0.203 0.921,-0.262 L 0.797,-0.424 C 0.678,-0.329 0.574,-0.209 0.484,-0.066 0.395,0.077 0.33,0.226 0.292,0.381 L 0,0 Z"; - const RIGHT_CLOVER_LETTER_7 = "M 0,0 C 0.065,0.084 0.146,0.127 0.243,0.129 0.358,0.131 0.498,0.068 0.664,-0.058 0.83,-0.185 0.927,-0.304 0.955,-0.417 0.979,-0.509 0.958,-0.598 0.894,-0.683 0.829,-0.767 0.744,-0.811 0.638,-0.813 0.533,-0.815 0.396,-0.752 0.228,-0.623 0.064,-0.498 -0.033,-0.378 -0.062,-0.266 -0.085,-0.173 -0.065,-0.085 0,0 M 0.139,-0.106 C 0.123,-0.126 0.116,-0.149 0.117,-0.175 0.118,-0.2 0.132,-0.23 0.159,-0.265 0.193,-0.309 0.262,-0.371 0.365,-0.449 0.467,-0.528 0.542,-0.577 0.588,-0.596 0.635,-0.615 0.67,-0.621 0.695,-0.615 c 0.025,0.005 0.045,0.018 0.06,0.038 0.015,0.02 0.023,0.043 0.022,0.069 -0.001,0.026 -0.015,0.056 -0.042,0.09 C 0.701,-0.374 0.632,-0.312 0.53,-0.234 0.427,-0.155 0.352,-0.106 0.306,-0.087 0.26,-0.068 0.224,-0.062 0.199,-0.067 0.174,-0.073 0.154,-0.086 0.139,-0.106"; - const RIGHT_CLOVER_LETTER_8 = "M 0,0 -0.156,0.119 0.283,0.692 0.404,0.599 C 0.415,0.516 0.445,0.417 0.495,0.302 0.544,0.186 0.608,0.078 0.687,-0.023 c 0.078,-0.1 0.157,-0.18 0.234,-0.239 L 0.797,-0.424 C 0.678,-0.329 0.574,-0.209 0.484,-0.066 0.395,0.077 0.331,0.226 0.292,0.381 L 0,0 Z"; - const RIGHT_CLOVER_H_1 = "M63.09,15.01L58.08 10.15 59.06 9.14 61.03 11.05 62.96 9.07 60.99 7.16 61.97 6.16 66.97 11.02 65.99 12.02 63.8 9.89 61.88 11.87 64.07 14 63.09 15.01z"; - const RIGHT_CLOVER_H_2 = "M74.49,10.89L79.55 6.08 80.52 7.1 78.52 8.99 80.43 10.99 82.42 9.1 83.39 10.12 78.33 14.93 77.36 13.91 79.58 11.8 77.67 9.8 75.45 11.9 74.49 10.89z"; - const RIGHT_CLOVER_H_3 = "M79.17,21.77L84.6 26.16 83.72 27.25 81.58 25.52 79.84 27.67 81.98 29.4 81.1 30.49 75.67 26.11 76.55 25.02 78.93 26.93 80.67 24.79 78.29 22.87 79.17 21.77z"; - const RIGHT_CLOVER_H_4 = "M65.96,25.93L60.65 30.45 59.74 29.38 61.83 27.6 60.04 25.5 57.94 27.27 57.03 26.2 62.35 21.68 63.26 22.75 60.93 24.73 62.73 26.84 65.05 24.86 65.96 25.93"; - - const CENTER_DIVIDER = "M51,0 L51,39 Z"; - - public static $lockup_templates_directory = __DIR__ . '/LockupTemplates'; - - public static function createPreviewLockup($template, $lockup, $orient = 'horiz') { - return self::createLockup($template, $lockup, $orient, 'RGB', FALSE, TRUE); - } - - public static function createLockup($template, $lockup, $orient = 'horiz', $style = 'RGB', $rev = FALSE, $preview = FALSE) { - $svg = new \EasySVG(); - $main_text_color = self::SCARLET; - $secondary_text_color = self::BLACK; - $n_main_color = self::SCARLET; - $n_secondary_color = self::WHITE; - $clover_color = self::FOUR_H_GREEN; - $clover_h_color = NULL; - - switch ($style) { - case 'RGB': - if ($template == 'acronym_social') { - $main_text_color = self::WHITE; - $secondary_text_color = self::WHITE; - $n_main_color = self::WHITE; - $n_secondary_color = self::SCARLET; - break; - } - if (!$rev) { - $main_text_color = self::SCARLET; - $secondary_text_color = self::BLACK; - $n_main_color = self::SCARLET; - $n_secondary_color = self::WHITE; - $clover_color = self::FOUR_H_GREEN; - } else { - $main_text_color = self::WHITE; - $secondary_text_color = self::WHITE; - $n_main_color = self::SCARLET; - $n_secondary_color = self::WHITE; - $clover_color = self::WHITE; - } - break; - case 'pms186cp': - if (!$rev) { - $main_text_color = self::PANTONE_RED; - $secondary_text_color = self::PANTONE_RED; - $n_main_color = self::PANTONE_RED; - $n_secondary_color = self::WHITE; - $clover_color = self::FOUR_H_GREEN; - } else { - $main_text_color = self::WHITE; - $secondary_text_color = self::WHITE; - $n_main_color = self::PANTONE_RED; - $n_secondary_color = self::WHITE; - $clover_color = self::WHITE; - $clover_h_color = self::BLACK; - } - break; - case '4c': - if (!$rev) { - $main_text_color = self::CMYK_RED; - $secondary_text_color = self::BLACK; - $n_main_color = self::CMYK_RED; - $n_secondary_color = self::WHITE; - $clover_color = self::FOUR_H_GREEN; - } else { - $main_text_color = self::WHITE; - $secondary_text_color = self::WHITE; - $n_main_color = self::CMYK_RED; - $n_secondary_color = self::WHITE; - $clover_color = self::WHITE; - $clover_h_color = self::BLACK; - } - break; - case 'blk': - if (!$rev) { - $main_text_color = self::BLACK; - $secondary_text_color = self::BLACK; - $n_main_color = self::BLACK; - $n_secondary_color = self::WHITE; - $clover_color = self::BLACK; - } else { - $main_text_color = self::WHITE; - $secondary_text_color = self::WHITE; - $n_main_color = self::WHITE; - $n_secondary_color = self::BLACK; - $clover_color = self::WHITE; - } - break; - default: - break; - } - - if (!isset($clover_h_color)) { - $clover_h_color = $n_secondary_color; - } - - if ($preview) { - $svg->addAttribute("class", "preview"); - } - - $svg_file = new SvgFile; - - if ($orient == 'horiz') { - switch ($template) { - case 'org_only': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(12); - $svg->setFontColor($main_text_color); - $svg->addText($lockup->org_name, 44, 7.75); - $text_width = $svg->textDimensions($lockup->org_name)[0]; - - $svg->addAttribute('viewBox', "0 0 " . ($text_width + 44) . " 36"); - $svg_file->height = 36; - $svg_file->width = $text_width + 44; - if (!$preview) { - $svg->addAttribute('height', 36); - $svg->addAttribute('width', $text_width + 44); - } - break; - case 'org_two_line': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(12); - $svg->setFontColor($main_text_color); - $svg->addText($lockup->org_name, 44, 2.25); - $main_text_width = $svg->textDimensions($lockup->org_name)[0]; - - $svg->addText($lockup->org_second_line, 44, 13.25); - $secondary_text_width = $svg->textDimensions($lockup->org_second_line)[0]; - - $svg->addAttribute('viewBox', "0 0 " . (max($main_text_width, $secondary_text_width) + 44) . " 36"); - $svg_file->height = 36; - $svg_file->width = max($main_text_width, $secondary_text_width) + 44; - if (!$preview) { - $svg->addAttribute('height', 36); - $svg->addAttribute('width', max($main_text_width, $secondary_text_width) + 44); - } - break; - case 'org_subject': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(12); - $svg->setFontColor($main_text_color); - $svg->addText($lockup->org_name, 44, 7.75); - $main_text_width = $svg->textDimensions($lockup->org_name)[0]; - - $svg->setFontSVG(self::MERCURY); - $svg->setLetterSpacing(0); - $svg->setFontSize(8.125); - $svg->setFontColor($secondary_text_color); - $svg->addText($lockup->subject, 44, 26); - $secondary_text_width = $svg->textDimensions($lockup->subject)[0]; - - $svg->addAttribute('viewBox', "0 0 " . (max($main_text_width, $secondary_text_width) + 44) . " 38"); - $svg_file->height = 38; - $svg_file->width = max($main_text_width, $secondary_text_width) + 44; - if (!$preview) { - $svg->addAttribute('height', 38); - $svg->addAttribute('width', max($main_text_width, $secondary_text_width) + 44); - } - break; - case 'org_subject_1_2': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(12); - $svg->setFontColor($main_text_color); - $svg->addText($lockup->org_name, 44, -5.8); - $main_text_width = $svg->textDimensions($lockup->org_name)[0]; - - $svg->setFontSVG(self::MERCURY); - $svg->setLetterSpacing(0); - $svg->setFontSize(8.125); - $svg->setFontColor($secondary_text_color); - $svg->addText($lockup->subject, 44, 17); - $secondary_text_width = $svg->textDimensions($lockup->subject)[0]; - - $svg->addText($lockup->subject_second_line, 44, 26); - $third_width = $svg->textDimensions($lockup->subject_second_line)[0]; - - $svg->addAttribute('viewBox', "0 0 " . (max($main_text_width, $secondary_text_width, $third_width) + 44) . " 38"); - $svg_file->height = 38; - $svg_file->width = max($main_text_width, $secondary_text_width, $third_width) + 44; - if (!$preview) { - $svg->addAttribute('height', 38); - $svg->addAttribute('width', max($main_text_width, $secondary_text_width, $third_width) + 44); - } - break; - case 'org_subject_2_1': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(12); - $svg->setFontColor($main_text_color); - $svg->addText($lockup->org_name, 44, -5.8); - $main_text_width = $svg->textDimensions($lockup->org_name)[0]; - - $svg->addText($lockup->org_second_line, 44, 5.2); - $third_width = $svg->textDimensions($lockup->org_second_line)[0]; - - $svg->setFontSVG(self::MERCURY); - $svg->setLetterSpacing(0); - $svg->setFontSize(8.125); - $svg->setFontColor($secondary_text_color); - $svg->addText($lockup->subject, 44, 26); - $secondary_text_width = $svg->textDimensions($lockup->subject)[0]; - - $svg->addAttribute('viewBox', "0 0 " . (max($main_text_width, $secondary_text_width, $third_width) + 44) . " 38"); - $svg_file->height = 38; - $svg_file->width = max($main_text_width, $secondary_text_width, $third_width) + 44; - if (!$preview) { - $svg->addAttribute('height', 38); - $svg->addAttribute('width', max($main_text_width, $secondary_text_width, $third_width) + 44); - } - break; - case 'org_subject_2_2': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(12); - $svg->setFontColor($main_text_color); - $svg->addText($lockup->org_name, 44, -5.8); - $main_text_width = $svg->textDimensions($lockup->org_name)[0]; - - $svg->addText($lockup->org_second_line, 44, 4.2); - $third_width = $svg->textDimensions($lockup->org_second_line)[0]; - - $svg->setFontSVG(self::MERCURY); - $svg->setLetterSpacing(0); - $svg->setFontSize(7); - $svg->setFontColor($secondary_text_color); - $svg->addText($lockup->subject, 44, 19); - $secondary_text_width = $svg->textDimensions($lockup->subject)[0]; - - $svg->addText($lockup->subject_second_line, 44, 27); - $fourth_width = $svg->textDimensions($lockup->subject_second_line)[0]; - - $svg->addAttribute('viewBox', "0 0 " . (max($main_text_width, $secondary_text_width, $third_width, $fourth_width) + 44) . " 38"); - $svg_file->height = 38; - $svg_file->width = max($main_text_width, $secondary_text_width, $third_width, $fourth_width) + 44; - if (!$preview) { - $svg->addAttribute('height', 38); - $svg->addAttribute('width', max($main_text_width, $secondary_text_width, $third_width, $fourth_width) + 44); - } - break; - case 'acronym': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(22); - $svg->setFontColor($main_text_color); - $svg->addText($lockup->acronym, 44, -0.5); - $text_width = $svg->textDimensions($lockup->acronym)[0]; - - $svg->addAttribute('viewBox', "0 0 " . ($text_width + 44) . " 36"); - $svg_file->height = 38; - $svg_file->width = $text_width + 44; - if (!$preview) { - $svg->addAttribute('height', 36); - $svg->addAttribute('width', $text_width + 44); - } - break; - case 'acronym_subject': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(22); - $svg->setFontColor($main_text_color); - $svg->addText($lockup->acronym, 44, -10.5); - $main_text_width = $svg->textDimensions($lockup->acronym)[0]; - - $svg->setFontSize(16.25); - $svg->setFontColor($secondary_text_color); - $svg->addText($lockup->acronym_subject, 44, 16.25); - $secondary_text_width = $svg->textDimensions($lockup->acronym_subject)[0]; - - $svg->addAttribute('viewBox', "0 0 " . (max($main_text_width, $secondary_text_width) + 44) . " 40"); - $svg_file->height = 40; - $svg_file->width = max($main_text_width, $secondary_text_width) + 44; - if (!$preview) { - $svg->addAttribute('height', 40); - $svg->addAttribute('width', max($main_text_width, $secondary_text_width) + 44); - } - break; - case 'extension': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(22); - $svg->setFontColor($main_text_color); - $svg->addText('EXTENSION', 44, -0.5); - $main_text_width = $svg->textDimensions('EXTENSION')[0]; - - $svg->setFontSVG(self::MERCURY); - $svg->setLetterSpacing(0); - $svg->setFontSize(8.125); - $svg->setFontColor($secondary_text_color); - $svg->addText($lockup->extension_county, 44, 26); - $secondary_text_width = $svg->textDimensions($lockup->extension_county)[0]; - - $svg->addAttribute('viewBox', "0 0 " . (max($main_text_width, $secondary_text_width) + 44) . " 38"); - $svg_file->height = 38; - $svg_file->width = max($main_text_width, $secondary_text_width) + 44; - if (!$preview) { - $svg->addAttribute('height', 38); - $svg->addAttribute('width', max($main_text_width, $secondary_text_width) + 44); - } - break; - case 'ncta': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(22); - $svg->setFontColor($main_text_color); - $svg->addText('NCTA', 44, -0.5); - $main_text_width = $svg->textDimensions('NCTA')[0]; - - $svg->setFontSVG(self::MERCURY); - $svg->setLetterSpacing(0); - $svg->setFontSize(8.125); - $svg->setFontColor($secondary_text_color); - $svg->addText($lockup->subject, 44, 26); - $secondary_text_width = $svg->textDimensions($lockup->subject)[0]; - - $svg->addAttribute('viewBox', "0 0 " . (max($main_text_width, $secondary_text_width) + 44) . " 38"); - $svg_file->height = 38; - $svg_file->width = max($main_text_width, $secondary_text_width) + 44; - if (!$preview) { - $svg->addAttribute('height', 38); - $svg->addAttribute('width', max($main_text_width, $secondary_text_width) + 44); - } - break; - } - - $svg->addPath(self::HORIZ_N_R_CIRCLE, array('fill' => $n_main_color)); - if (!($style == 'blk' && $rev)) { - $svg->addPath(self::HORIZ_N_R_FILL, array('fill' => $n_secondary_color)); - $svg->addPath(self::HORIZ_N_SERIF, array('fill' => $n_secondary_color)); - } - $svg->addPath(self::HORIZ_N_FILL, array('fill' => $n_main_color)); - $svg->addPath(self::HORIZ_N_OUTLINE_R, array('fill' => $n_main_color)); - } else if ($orient == 'vert') { - switch ($template) { - case 'org_only': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(12); - $svg->setFontColor($main_text_color); - $text_width = $svg->textDimensions($lockup->org_name)[0]; - $svg->addText($lockup->org_name, 100 - ($text_width / 2), 37); - break; - case 'org_two_line': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(12); - $svg->setFontColor($main_text_color); - $text_width = $svg->textDimensions($lockup->org_name)[0]; - $svg->addText($lockup->org_name, 100 - ($text_width / 2), 37); - - $text_width = $svg->textDimensions($lockup->org_second_line)[0]; - $svg->addText($lockup->org_second_line, 100 - ($text_width / 2), 48); - break; - case 'org_subject': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(12); - $svg->setFontColor($main_text_color); - $text_width = $svg->textDimensions($lockup->org_name)[0]; - $svg->addText($lockup->org_name, 100 - ($text_width / 2), 37); - - $svg->setFontSVG(self::MERCURY); - $svg->setLetterSpacing(0); - $svg->setFontSize(8.125); - $svg->setFontColor($secondary_text_color); - $text_width = $svg->textDimensions($lockup->subject)[0]; - $svg->addText($lockup->subject, 100 - ($text_width / 2), 55); - break; - case 'org_subject_1_2': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(12); - $svg->setFontColor($main_text_color); - $text_width = $svg->textDimensions($lockup->org_name)[0]; - $svg->addText($lockup->org_name, 100 - ($text_width / 2), 37); - - $svg->setFontSVG(self::MERCURY); - $svg->setLetterSpacing(0); - $svg->setFontSize(8.125); - $svg->setFontColor($secondary_text_color); - $text_width = $svg->textDimensions($lockup->subject)[0]; - $svg->addText($lockup->subject, 100 - ($text_width / 2), 55); - - $text_width = $svg->textDimensions($lockup->subject_second_line)[0]; - $svg->addText($lockup->subject_second_line, 100 - ($text_width / 2), 64); - break; - case 'org_subject_2_1': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(12); - $svg->setFontColor($main_text_color); - $text_width = $svg->textDimensions($lockup->org_name)[0]; - $svg->addText($lockup->org_name, 100 - ($text_width / 2), 37); - - $text_width = $svg->textDimensions($lockup->org_second_line)[0]; - $svg->addText($lockup->org_second_line, 100 - ($text_width / 2), 48); - - $svg->setFontSVG(self::MERCURY); - $svg->setLetterSpacing(0); - $svg->setFontSize(8.125); - $svg->setFontColor($secondary_text_color); - $text_width = $svg->textDimensions($lockup->subject)[0]; - $svg->addText($lockup->subject, 100 - ($text_width / 2), 66); - break; - case 'org_subject_2_2': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(12); - $svg->setFontColor($main_text_color); - $text_width = $svg->textDimensions($lockup->org_name)[0]; - $svg->addText($lockup->org_name, 100 - ($text_width / 2), 37); - - $text_width = $svg->textDimensions($lockup->org_second_line)[0]; - $svg->addText($lockup->org_second_line, 100 - ($text_width / 2), 48); - - $svg->setFontSVG(self::MERCURY); - $svg->setLetterSpacing(0); - $svg->setFontSize(8.125); - $svg->setFontColor($secondary_text_color); - $text_width = $svg->textDimensions($lockup->subject)[0]; - $svg->addText($lockup->subject, 100 - ($text_width / 2), 61); - - $text_width = $svg->textDimensions($lockup->subject_second_line)[0]; - $svg->addText($lockup->subject_second_line, 100 - ($text_width / 2), 70); - break; - case 'acronym': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(22); - $svg->setFontColor($main_text_color); - $text_width = $svg->textDimensions($lockup->acronym)[0]; - $svg->addText($lockup->acronym, 100 - ($text_width / 2), 32); - break; - case 'acronym_social': - $svg->addPath(self::VERT_BACKGROUND, array('fill' => $n_secondary_color)); - - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(22); - $svg->setFontColor($main_text_color); - $text_width = $svg->textDimensions($lockup->acronym)[0]; - $svg->addText($lockup->acronym, 100 - ($text_width / 2), 32); - break; - case 'acronym_subject': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(22); - $svg->setFontColor($main_text_color); - $text_width = $svg->textDimensions($lockup->acronym)[0]; - $svg->addText($lockup->acronym, 100 - ($text_width / 2), 32); - - $svg->setFontSize(16.25); - $svg->setFontColor($secondary_text_color); - $text_width = $svg->textDimensions($lockup->acronym_subject)[0]; - $svg->addText($lockup->acronym_subject, 100 - ($text_width / 2), 56.25); - break; - case 'acronym_subject_2_1': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(22); - $svg->setFontColor($main_text_color); - $text_width = $svg->textDimensions($lockup->acronym)[0]; - $svg->addText($lockup->acronym, 100 - ($text_width / 2), 32); - $text_width = $svg->textDimensions($lockup->acronym_second_line)[0]; - $svg->addText($lockup->acronym_second_line, 100 - ($text_width / 2), 52); - - $svg->setFontSize(16.25); - $svg->setFontColor($secondary_text_color); - $text_width = $svg->textDimensions($lockup->acronym_subject)[0]; - $svg->addText($lockup->acronym_subject, 100 - ($text_width / 2), 80); - break; - case 'extension': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(22); - $svg->setFontColor($main_text_color); - $text_width = $svg->textDimensions('EXTENSION')[0]; - $svg->addText('EXTENSION', 100 - ($text_width / 2), 32); - - $svg->setFontSVG(self::MERCURY); - $svg->setLetterSpacing(0); - $svg->setFontSize(8.125); - $svg->setFontColor($secondary_text_color); - $text_width = $svg->textDimensions($lockup->extension_county)[0]; - $svg->addText($lockup->extension_county, 100 - ($text_width / 2), 60); - break; - case 'ncta': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(22); - $svg->setFontColor($main_text_color); - $text_width = $svg->textDimensions('NCTA')[0]; - $svg->addText('NCTA', 100 - ($text_width / 2), 32); - - $svg->setFontSVG(self::MERCURY); - $svg->setLetterSpacing(0); - $svg->setFontSize(8.125); - $svg->setFontColor($secondary_text_color); - $text_width = $svg->textDimensions($lockup->subject)[0]; - $svg->addText($lockup->subject, 100 - ($text_width / 2), 60); - break; - case 'extension_4h': - $svg->setFontSVG(self::TUNGSTEN); - $svg->setLetterSpacing(0.05); - $svg->setFontSize(28); - $svg->setFontColor($main_text_color); - $text_width = $svg->textDimensions('EXTENSION')[0]; - $svg->addText('EXTENSION', 100 - ($text_width / 2), 32); - - $svg->setFontSVG(self::MERCURY); - $svg->setLetterSpacing(0); - $svg->setFontSize(8.125); - $svg->setFontColor($secondary_text_color); - $text_width = $svg->textDimensions($lockup->extension_county)[0]; - $svg->addText($lockup->extension_county, 100 - ($text_width / 2), 66); - break; - } - - $height = 80; - $width = 200; - $x = 0; - $y = 0; - switch ($template) { - case 'org_subject_2_2': - $height = 88; - break; - case 'acronym_subject_2_1': - $height = 104; - break; - case 'acronym_social': - $height = 100; - $width = 100; - $y = -20; - $x = 50; - break; - } - - $svg->addAttribute('viewBox', $x . " " . $y . " " . ($width) . " " . ($height)); - $svg_file->height = $height; - $svg_file->width = $width; - if (!$preview) { - $svg->addAttribute('height', $height); - $svg->addAttribute('width', $width); - } - - if ($template == 'extension_4h') { - $svg->addPath(self::LEFT_N_R_CIRCLE, array('fill' => $n_main_color, 'transform' => 'translate(50.5 0.1)')); - if (!($style == 'blk' && $rev)) { - $svg->addPath(self::LEFT_N_R_FILL, array('fill' => $n_secondary_color, 'transform' => 'translate(50.5 0.1)')); - $svg->addPath(self::LEFT_N_SERIF, array('fill' => $n_secondary_color, 'transform' => 'translate(50.5 0.1)')); - } - $svg->addPath(self::LEFT_N_OUTLINE, array('fill' => $n_main_color, 'transform' => 'translate(50.5 0.1)')); - $svg->addPath(self::LEFT_N_FILL, array('fill' => $n_main_color, 'transform' => 'translate(56, 0)')); - $svg->addPath(self::LEFT_N_OUTLINE_R, array('fill' => $n_main_color, 'transform' => 'translate(50.5 0.1)')); - - $svg->addPath(self::RIGHT_CLOVER_FILL, array('fill' => $clover_color, 'transform' => 'translate(144.6758,24.75) rotate(180) scale(-1,1)')); - $svg->addPath(self::RIGHT_CLOVER_LETTER_1, array('fill' => $clover_color, 'transform' => 'translate(140.91,34.26) rotate(180) scale(-1,1)')); - $svg->addPath(self::RIGHT_CLOVER_LETTER_2, array('fill' => $clover_color, 'transform' => 'translate(140.737,33.5) rotate(180) scale(-1,1)')); - $svg->addPath(self::RIGHT_CLOVER_LETTER_3, array('fill' => $clover_color, 'transform' => 'translate(141.0319,32.28) rotate(180) scale(-1,1)')); - $svg->addPath(self::RIGHT_CLOVER_LETTER_4, array('fill' => $clover_color, 'transform' => 'translate(142.26,31.9) rotate(180) scale(-1,1)')); - $svg->addPath(self::RIGHT_CLOVER_LETTER_5, array('fill' => $clover_color, 'transform' => 'translate(143.3116,30.35) rotate(180) scale(-1,1)')); - $svg->addPath(self::RIGHT_CLOVER_LETTER_6, array('fill' => $clover_color, 'transform' => 'translate(143.4054,29.43) rotate(180) scale(-1,1)')); - $svg->addPath(self::RIGHT_CLOVER_LETTER_7, array('fill' => $clover_color, 'transform' => 'translate(143.971,28.3368) rotate(180) scale(-1,1)')); - $svg->addPath(self::RIGHT_CLOVER_LETTER_8, array('fill' => $clover_color, 'transform' => 'translate(144.4453,28.0718) rotate(180) scale(-1,1)')); - $svg->addPath(self::RIGHT_CLOVER_H_1, array('fill' => $clover_h_color, 'transform' => 'translate(56, 0)')); - $svg->addPath(self::RIGHT_CLOVER_H_2, array('fill' => $clover_h_color, 'transform' => 'translate(56, 0)')); - $svg->addPath(self::RIGHT_CLOVER_H_3, array('fill' => $clover_h_color, 'transform' => 'translate(56, 0)')); - $svg->addPath(self::RIGHT_CLOVER_H_4, array('fill' => $clover_h_color, 'transform' => 'translate(56, 0)')); - - $svg->addPath(self::CENTER_DIVIDER, array('fill' => $secondary_text_color, 'transform' => 'translate(50.5 0.1)', 'stroke' => $secondary_text_color, 'stroke-width' => '0.5pt')); - } else { - $svg->addPath(self::VERT_N_R_CIRCLE, array('fill' => $n_main_color)); - if (!($style == 'blk' && $rev)) { - $svg->addPath(self::VERT_N_R_FILL, array('fill' => $n_secondary_color)); - $svg->addPath(self::VERT_N_SERIF, array('fill' => $n_secondary_color)); - } - $svg->addPath(self::VERT_N_FILL, array('fill' => $n_main_color)); - $svg->addPath(self::VERT_N_OUTLINE_R, array('fill' => $n_main_color)); - } - } - - $svg_file->svg_text = $svg->asXML(); - - return $svg_file; - } + const SCARLET = '#d00000'; + const WHITE = '#ffffff'; + const BLACK = '#000000'; + const PANTONE_RED = '#cf0a2c'; #pantone 186cp + const CMYK_RED = '#da1a32 device-cmyk(0.02, 1.00, 0.85, 0.06)'; + const FOUR_H_GREEN = '#129a63'; #pantone for this is 347U + + const TUNGSTEN = \Core::ROOT . '/src/SVGFonts/Tungsten-Semibold.svg'; + const MERCURY = \Core::ROOT . '/src/SVGFonts/MercuryDisplay-SemIta.svg'; + + const HORIZ_N_OUTLINE_R = "M37.27894812 34.48421122h.33157896c.14210526 0 .1894737 0 .26052632.04736842.09473684.04736842.14210526.14210526.14210526.26052632 0 .09473684-.0236842.16578948-.07105263.2368421-.0236842.04736843-.07105263.04736843-.14210526.09473685h-.02368422l.26052633.49736844h-.1894737l-.2368421-.47368422h-.14210527v.47368422h-.18947368v-1.13684212zm.28421054.49736843h.09473684c.09473684-.0236842.14210527-.07105264.14210527-.1894737 0-.07105262-.0236842-.11842105-.09473685-.14210526h-.23684211v.33157895h.09473686zM34.815789 0H20.842105v10.65789H23.210526v5.87369L13.073684.54474 12.742105 0H0v10.65789H2.368421v14.68422H0V36H15.157895V25.34211H12.789474v-5.87369l10.136842 15.98684.355263.54474H36V25.34211H33.631579V10.65789H36V0h-1.184211zm.710527 1.18421v9h-2.368421v15.63158h2.368421v9.71053H23.542105l-.213158-.33158-11.013158-17.36053v7.98158h2.368422v9.71053H.473684v-9.71053h2.368421V10.18421H.473684V.47368h11.984211l.213158.33158 11.013158 17.36053v-7.98158h-2.368422V.47368h14.210527v.71053z"; + const HORIZ_N_R_CIRCLE = "M37.681579 34.10526c-.544737 0-.971053.42632-.971053.94737S37.136842 36 37.657895 36c.521052 0 .947368-.42632.947368-.94737s-.426316-.94737-.923684-.94737zm-.02368 1.70527c-.426316 0-.757895-.33158-.757895-.7579 0-.42631.331579-.75789.757895-.75789.402631 0 .757894.35526.757894.75789 0 .42632-.331578.7579-.757894.7579z"; + const HORIZ_N_FILL = "M24.394737 20.60526L12.078947 1.18421H1.184211v8.28947h2.368421v17.05264H1.184211v8.28947h12.789473v-8.28947h-2.368421V15.39474l12.31579 19.42105h10.894736v-8.28947h-2.368421V9.47368h2.368421V1.18421H22.026316v8.28947h2.368421v11.13158z"; + const HORIZ_N_SERIF = "M37.657895 35.81053c-.426316 0-.757895-.33158-.757895-.7579 0-.42631.331579-.75789.757895-.75789.402631 0 .757894.35526.757894.75789 0 .42632-.331578.7579-.757894.7579z"; + const HORIZ_N_R_FILL = "M34.815789.47368h-13.5v9.71053h2.368422v7.98158L12.671053.80526l-.189474-.33158H.473684v9.71053h2.368421v15.63158H.473684v9.71053h14.210527v-9.71053h-2.368422v-7.98158l11.013158 17.36053.213158.33158h11.984211v-9.71053h-2.368421V10.18421h2.368421V.47368h-.710527zM13.973684 26.52632v8.28947H1.184211v-8.28947h2.368421V9.47368H1.184211V1.18421h10.894736l12.31579 19.42105V9.47368h-2.368421V1.18421h12.789473v8.28947h-2.368421v17.05264h2.368421v8.28947H23.921053l-12.31579-19.42105v11.13158h2.368421z"; + + const VERT_N_OUTLINE_R = "M119.27942132 34.48421092h.33157896c.14210526 0 .1894737 0 .26052632.04736842.09473684.04736842.14210526.14210526.14210526.26052632 0 .09473684-.0236842.16578948-.07105263.2368421-.0236842.04736843-.07105263.04736843-.14210526.09473685h-.02368422l.26052633.49736844h-.1894737l-.2368421-.47368422h-.14210527v.47368422h-.18947368v-1.13684212zm.28421054.49736843h.09473684c.09473684-.0236842.14210527-.07105264.14210527-.1894737 0-.07105262-.02368422-.11842105-.09473685-.14210526h-.23684211v.33157895h.09473686zM116.81579 0h-13.97368V10.65789h2.36842v5.87369L95.073684.5447397 94.742105 0H82V10.65789h2.368421v14.68422H82V36h15.157896V25.34211H94.789475v-5.87369l10.136845 15.98684.35526.54474H118V25.34211h-2.36842V10.65789H118V 0h-1.18421zm.71053 1.18421V10.18421h-2.36842v15.63158h2.36842v9.71053H105.54211l-.21316-.33158-11.013161-17.36053v7.98158h2.368422v9.71053H82.473684v-9.71053h2.368421V10.18421h-2.368421V.4736797h11.984211l.213158.33158L105.68421 18.16579v-7.98158h-2.36842V.4736797h14.21053v.71053z"; + const VERT_N_R_CIRCLE = "M119.68205 34.10526c-.54474 0-.97105.42632-.97105.94737s.42631.94737.94737.94737c.52105 0 .94736-.42632.94736-.94737s-.42631-.94737-.92368-.94737zm-.0237 1.70527c-.42632 0-.7579-.33158-.7579-.7579 0-.42631.33158-.75789.7579-.75789.40263 0 .75789.35526.75789.75789 0 .42632-.33157.7579-.75789.7579z"; + const VERT_N_FILL = "M106.39474 20.60526L94.078946 1.1842097H83.18421V9.47368h2.368421v17.05264H83.18421v8.28947h12.789473v-8.28947h-2.368421V15.39474l12.315788 19.42105h10.89474v-8.28947h-2.36842V9.47368h2.36842V1.1842097h-12.78947V9.47368h2.36842v11.13158z"; + const VERT_N_SERIF = "M119.65837 35.81053c-.42632 0-.7579-.33158-.7579-.7579 0-.42631.33158-.75789.7579-.75789.40263 0 .75789.35526.75789.75789 0 .42632-.33158.7579-.75789.7579z"; + const VERT_N_R_FILL = "M116.81579.4736797h-13.5V10.18421h2.36842v7.98158L94.67105.8052597l-.189474-.33158H82.473681V10.18421h2.368421v15.63158h-2.368421v9.71053h14.210527v-9.71053h-2.368422v-7.98158l11.013164 17.36053.21316.33158H117.52632v-9.71053h-2.36842V10.18421h2.36842V.4736797h-.71053zM95.973681 26.52632v8.28947H83.184208v-8.28947h2.368421V9.47368h-2.368421V1.1842097h10.894736L106.39474 20.60526V9.47368h-2.36843V1.1842097h12.78948V9.47368h-2.36842v17.05264h2.36842v8.28947h-10.89474L93.60526 15.39474v11.13158h2.368421z"; + const VERT_BACKGROUND = "M-100 -100 L300 -100 L300 100 L-100 100 Z"; + + const LEFT_N_R_FILL = "M42.79 36.46 a .76 .76 0 1 0 1.52 0 .76 .76 0 1 0 -1.52 0"; + const LEFT_N_R_CIRCLE = "M42.79 36.46 a .76 .76 0 1 0 1.52 0 .76 .76 0 1 0 -1.52 0 m -.19 0 a .95 .95 0 1 0 1.9 0 .95 .95 0 1 0 -1.9 0"; + const LEFT_N_OUTLINE_R = "M43.46 36.39h.09a.17 .17,0,0,0,.14 -.18 .13 .13,0,0,0 -.09 -.14h -.24v.34Zm-.29 -.5h.33a.54 .54,0,0,1,.25,0,.29 .29,0,0,1,.15 .27 .34 .34,0,0,1 -.08 .23 .37 .37,0,0,1 -.13 .09h0l .26 .51h -.19l -.25 -.48h -.13V37h -.19Z"; + const LEFT_N_OUTLINE = "M41.42,2.6v9H39V27.23h2.37v9.71h-12l-.21-.33-11-17.35v8h2.37v9.71H6.37V27.23H8.73V11.6H6.37V1.89h12l.21.33,11,17.35v-8H27.21V1.89H41.42Zm-.71-1.18h-14V12.07H29.1v5.87L19,2l-.35-.55H5.89V12.07H8.26V26.75H5.89V37.41H21V26.75H18.68V20.89l10.13,16,.35.55H41.89V26.75H39.52V12.07h2.37V1.41Z"; + const LEFT_N_SERIF = "M19.87,27.94h0v8.29H7.08V27.94H9.44V10.89H7.08V2.6H18L30.29,22V10.89H27.92V2.6H40.71v8.29H38.34V27.94h2.37v8.29H29.81L17.5,16.81V27.94ZM40.71,1.89H27.21V11.6h2.37v8l-11-17.36-.21-.33h-12V11.6H8.73V27.23H6.37v9.71H20.58V27.23H18.21v-8l11,17.35.21.33h12V27.23H39V11.6h2.37V1.89Z"; + const LEFT_N_FILL = "M24.75,22.12L24.75 22.12 12.43 2.7 1.54 2.7 1.54 10.99 3.91 10.99 3.91 28.04 1.54 28.04 1.54 36.33 14.33 36.33 14.33 28.04 11.96 28.04 11.96 16.91 24.28 36.33 35.17 36.33 35.17 28.04 32.8 28.04 32.8 10.99 35.17 10.99 35.17 2.7 22.38 2.7 22.38 10.99 24.75 10.99 24.75 22.12z"; + + const RIGHT_CLOVER_FILL = "M 0,0 C 0.043,-1.596 -0.626,-2.857 -1.375,-3.591 -1.853,-4.06 -2.473,-4.264 -2.961,-4.647 -3.408,-4.998 -3.925,-5.511 -4.23,-6.073 -4.515,-6.598 -4.55,-7.139 -4.759,-7.552 -5.232,-8.487 -6.088,-9.297 -7.138,-9.77 c -2.089,-0.941 -4.443,0.226 -5.552,1.214 -0.81,0.723 -1.752,1.868 -2.221,3.011 -0.528,1.286 -0.877,3.177 -1.163,4.858 -0.067,0.392 -0.169,1.387 -0.529,1.426 -0.983,0.108 -0.542,-3.036 -0.476,-3.855 0.361,-4.453 1.786,-7.509 3.701,-10.087 l -3.331,0 c -1.722,2.837 -2.364,7.326 -2.009,12.2 0.046,0.631 0.162,1.617 -0.159,1.742 -0.65,0.255 -0.712,-0.845 -0.793,-1.267 -0.297,-1.566 -0.58,-3.64 -1.11,-4.964 -0.799,-1.998 -3.091,-4.355 -5.552,-4.595 -2.255,-0.22 -3.885,1.121 -4.6,2.482 -0.226,0.429 -0.306,0.975 -0.582,1.479 -0.297,0.542 -0.738,1.074 -1.163,1.426 -0.416,0.343 -0.92,0.491 -1.322,0.792 -0.846,0.631 -2.202,2.448 -1.692,4.383 0.235,0.892 1.119,2.31 1.745,2.905 0.889,0.846 2.278,1.807 3.754,2.112 1.61,0.333 4.377,0.159 6.345,0.159 0.62,0 1.616,-0.154 1.692,0.37 0.091,0.63 -1.038,0.65 -1.692,0.686 -1.976,0.109 -4.881,0.089 -6.504,0.634 -2.352,0.79 -4.811,3.171 -4.811,5.968 0,1.353 0.568,2.431 1.322,3.168 0.776,0.761 1.72,1.021 2.485,1.532 1.433,0.957 1.626,2.374 2.644,3.433 0.692,0.719 1.947,1.441 3.225,1.479 1.798,0.052 3.119,-0.757 4.071,-1.532 0.627,-0.51 1.209,-1.28 1.692,-2.007 1.239,-1.866 1.069,-4.991 1.269,-7.922 0.042,-0.61 0.159,-1.214 0.582,-1.214 0.629,0 0.62,1.637 0.634,1.901 0.126,2.351 0.224,5.139 0.899,6.601 0.964,2.085 3.215,4.143 5.817,4.173 1.671,0.018 2.982,-0.766 3.807,-1.849 0.744,-0.977 1.171,-2.393 2.432,-3.169 0.851,-0.523 1.823,-0.836 2.485,-1.531 1.507,-1.584 1.5,-4.436 0.106,-6.285 -1.041,-1.381 -2.84,-2.712 -5.076,-3.01 -1.321,-0.176 -3.923,-0.343 -5.605,-0.423 -0.675,-0.032 -1.457,-0.03 -1.428,-0.581 0.032,-0.594 1.062,-0.422 1.692,-0.422 3.1,0 6.263,0.202 8.249,-0.792 C -1.874,3.865 -0.431,2.073 0,0"; + const RIGHT_CLOVER_LETTER_1 = "M 0,0 -0.128,-0.168 -0.761,0.316 C -0.751,0.211 -0.764,0.106 -0.8,0.002 l -0.152,0.117 c 0.019,0.054 0.028,0.123 0.028,0.204 -0.001,0.082 -0.021,0.153 -0.059,0.213 L -0.879,0.671 0,0 Z"; + const RIGHT_CLOVER_LETTER_2 = "m 0,0 c -0.052,-0.029 -0.101,-0.042 -0.148,-0.037 -0.047,0.005 -0.09,0.022 -0.128,0.051 -0.065,0.05 -0.102,0.114 -0.109,0.192 -0.008,0.078 0.02,0.159 0.084,0.243 0.064,0.083 0.135,0.132 0.213,0.145 C -0.011,0.607 0.061,0.589 0.126,0.539 0.167,0.508 0.195,0.47 0.21,0.425 0.226,0.38 0.227,0.332 0.215,0.281 0.271,0.314 0.328,0.329 0.385,0.326 0.442,0.322 0.495,0.302 0.544,0.265 0.625,0.203 0.671,0.127 0.682,0.037 0.693,-0.054 0.666,-0.141 0.601,-0.227 0.54,-0.306 0.468,-0.357 0.386,-0.377 0.289,-0.402 0.197,-0.381 0.111,-0.316 0.064,-0.279 0.029,-0.234 0.007,-0.181 -0.015,-0.127 -0.017,-0.067 0,0 m -0.142,0.163 c 0.033,-0.025 0.066,-0.036 0.1,-0.031 0.033,0.004 0.062,0.022 0.086,0.054 0.024,0.032 0.034,0.065 0.03,0.098 C 0.07,0.318 0.051,0.347 0.017,0.373 -0.014,0.397 -0.047,0.407 -0.08,0.402 -0.114,0.398 -0.142,0.38 -0.166,0.349 -0.191,0.317 -0.201,0.284 -0.196,0.25 -0.192,0.216 -0.174,0.187 -0.142,0.163 m 0.363,-0.301 c 0.046,-0.036 0.091,-0.052 0.135,-0.048 0.045,0.004 0.08,0.024 0.107,0.059 0.027,0.035 0.036,0.073 0.029,0.115 C 0.484,0.03 0.457,0.069 0.41,0.105 0.368,0.136 0.326,0.15 0.284,0.146 0.241,0.142 0.206,0.122 0.179,0.087 0.147,0.046 0.138,0.004 0.151,-0.038 c 0.013,-0.041 0.036,-0.075 0.07,-0.1"; + const RIGHT_CLOVER_LETTER_3 = "m 0,0 0.135,0.176 0.474,-0.361 c 0.075,-0.058 0.125,-0.093 0.151,-0.105 0.042,-0.02 0.084,-0.024 0.128,-0.012 0.043,0.012 0.084,0.042 0.121,0.091 0.039,0.05 0.057,0.096 0.056,0.137 C 1.064,-0.033 1.051,0.002 1.025,0.03 0.999,0.058 0.952,0.098 0.882,0.151 L 0.399,0.52 0.534,0.697 0.993,0.346 C 1.098,0.266 1.169,0.204 1.205,0.161 1.241,0.119 1.264,0.073 1.274,0.025 1.285,-0.024 1.282,-0.076 1.267,-0.133 1.252,-0.189 1.218,-0.252 1.165,-0.321 1.101,-0.404 1.043,-0.46 0.991,-0.489 0.938,-0.517 0.887,-0.532 0.837,-0.533 0.787,-0.535 0.742,-0.527 0.702,-0.509 0.643,-0.482 0.565,-0.431 0.467,-0.356 L 0,0 Z"; + const RIGHT_CLOVER_LETTER_4 = "M 0,0 0.115,0.184 C 0.181,0.151 0.239,0.139 0.291,0.151 0.342,0.161 0.388,0.194 0.43,0.248 0.473,0.305 0.494,0.357 0.492,0.404 0.49,0.452 0.473,0.488 0.441,0.512 0.42,0.528 0.398,0.535 0.374,0.535 0.35,0.533 0.321,0.522 0.288,0.5 0.265,0.485 0.216,0.447 0.141,0.388 0.045,0.311 -0.035,0.266 -0.098,0.254 c -0.09,-0.017 -0.169,0.001 -0.238,0.054 -0.045,0.034 -0.077,0.079 -0.096,0.134 -0.02,0.055 -0.021,0.114 -0.005,0.177 0.016,0.063 0.049,0.128 0.101,0.195 0.084,0.11 0.171,0.174 0.262,0.193 C 0.017,1.025 0.104,1.005 0.187,0.946 L 0.058,0.764 C 0.007,0.791 -0.038,0.8 -0.076,0.79 -0.115,0.78 -0.154,0.751 -0.192,0.701 -0.231,0.649 -0.251,0.601 -0.252,0.556 -0.253,0.527 -0.242,0.503 -0.22,0.486 -0.199,0.47 -0.174,0.465 -0.146,0.472 -0.11,0.48 -0.049,0.519 0.037,0.589 0.123,0.66 0.193,0.707 0.246,0.732 0.299,0.757 0.354,0.766 0.409,0.761 0.465,0.755 0.52,0.732 0.576,0.689 0.626,0.651 0.662,0.601 0.685,0.54 0.707,0.478 0.709,0.414 0.692,0.347 0.674,0.28 0.636,0.208 0.578,0.132 0.493,0.021 0.402,-0.045 0.305,-0.065 0.209,-0.085 0.107,-0.063 0,0"; + const RIGHT_CLOVER_LETTER_5 = "m 0,0 0.185,0.13 c 0.076,-0.1 0.114,-0.198 0.114,-0.295 0,-0.096 -0.036,-0.191 -0.108,-0.285 -0.089,-0.116 -0.201,-0.181 -0.338,-0.195 -0.136,-0.015 -0.274,0.031 -0.411,0.136 -0.146,0.111 -0.23,0.235 -0.253,0.372 -0.023,0.136 0.012,0.266 0.106,0.388 0.082,0.107 0.18,0.17 0.294,0.188 0.068,0.011 0.145,0 0.23,-0.034 L -0.273,0.199 C -0.326,0.223 -0.378,0.229 -0.43,0.216 -0.481,0.203 -0.525,0.174 -0.561,0.127 -0.61,0.062 -0.627,-0.008 -0.612,-0.084 c 0.016,-0.076 0.076,-0.153 0.18,-0.233 0.11,-0.084 0.204,-0.124 0.281,-0.12 0.078,0.003 0.141,0.037 0.19,0.101 0.035,0.047 0.051,0.098 0.047,0.155 C 0.082,-0.124 0.053,-0.064 0,0"; + const RIGHT_CLOVER_LETTER_6 = "M 0,0 -0.156,0.119 0.283,0.692 0.404,0.599 C 0.415,0.516 0.445,0.417 0.495,0.301 0.544,0.186 0.608,0.078 0.687,-0.023 0.765,-0.124 0.844,-0.203 0.921,-0.262 L 0.797,-0.424 C 0.678,-0.329 0.574,-0.209 0.484,-0.066 0.395,0.077 0.33,0.226 0.292,0.381 L 0,0 Z"; + const RIGHT_CLOVER_LETTER_7 = "M 0,0 C 0.065,0.084 0.146,0.127 0.243,0.129 0.358,0.131 0.498,0.068 0.664,-0.058 0.83,-0.185 0.927,-0.304 0.955,-0.417 0.979,-0.509 0.958,-0.598 0.894,-0.683 0.829,-0.767 0.744,-0.811 0.638,-0.813 0.533,-0.815 0.396,-0.752 0.228,-0.623 0.064,-0.498 -0.033,-0.378 -0.062,-0.266 -0.085,-0.173 -0.065,-0.085 0,0 M 0.139,-0.106 C 0.123,-0.126 0.116,-0.149 0.117,-0.175 0.118,-0.2 0.132,-0.23 0.159,-0.265 0.193,-0.309 0.262,-0.371 0.365,-0.449 0.467,-0.528 0.542,-0.577 0.588,-0.596 0.635,-0.615 0.67,-0.621 0.695,-0.615 c 0.025,0.005 0.045,0.018 0.06,0.038 0.015,0.02 0.023,0.043 0.022,0.069 -0.001,0.026 -0.015,0.056 -0.042,0.09 C 0.701,-0.374 0.632,-0.312 0.53,-0.234 0.427,-0.155 0.352,-0.106 0.306,-0.087 0.26,-0.068 0.224,-0.062 0.199,-0.067 0.174,-0.073 0.154,-0.086 0.139,-0.106"; + const RIGHT_CLOVER_LETTER_8 = "M 0,0 -0.156,0.119 0.283,0.692 0.404,0.599 C 0.415,0.516 0.445,0.417 0.495,0.302 0.544,0.186 0.608,0.078 0.687,-0.023 c 0.078,-0.1 0.157,-0.18 0.234,-0.239 L 0.797,-0.424 C 0.678,-0.329 0.574,-0.209 0.484,-0.066 0.395,0.077 0.331,0.226 0.292,0.381 L 0,0 Z"; + const RIGHT_CLOVER_H_1 = "M63.09,15.01L58.08 10.15 59.06 9.14 61.03 11.05 62.96 9.07 60.99 7.16 61.97 6.16 66.97 11.02 65.99 12.02 63.8 9.89 61.88 11.87 64.07 14 63.09 15.01z"; + const RIGHT_CLOVER_H_2 = "M74.49,10.89L79.55 6.08 80.52 7.1 78.52 8.99 80.43 10.99 82.42 9.1 83.39 10.12 78.33 14.93 77.36 13.91 79.58 11.8 77.67 9.8 75.45 11.9 74.49 10.89z"; + const RIGHT_CLOVER_H_3 = "M79.17,21.77L84.6 26.16 83.72 27.25 81.58 25.52 79.84 27.67 81.98 29.4 81.1 30.49 75.67 26.11 76.55 25.02 78.93 26.93 80.67 24.79 78.29 22.87 79.17 21.77z"; + const RIGHT_CLOVER_H_4 = "M65.96,25.93L60.65 30.45 59.74 29.38 61.83 27.6 60.04 25.5 57.94 27.27 57.03 26.2 62.35 21.68 63.26 22.75 60.93 24.73 62.73 26.84 65.05 24.86 65.96 25.93"; + + const CENTER_DIVIDER = "M51,0 L51,39 Z"; + + public static $lockup_templates_directory = __DIR__ . '/LockupTemplates'; + + public static function createPreviewLockup($template, $lockup, $orient = 'horiz') { + return self::createLockup($template, $lockup, $orient, 'RGB', FALSE, TRUE); + } + + public static function createLockup($template, $lockup, $orient = 'horiz', $style = 'RGB', $rev = FALSE, $preview = FALSE) { + $svg = new \EasySVG(); + $main_text_color = self::SCARLET; + $secondary_text_color = self::BLACK; + $n_main_color = self::SCARLET; + $n_secondary_color = self::WHITE; + $clover_color = self::FOUR_H_GREEN; + $clover_h_color = NULL; + + switch ($style) { + case 'RGB': + if ($template == 'acronym_social') { + $main_text_color = self::WHITE; + $secondary_text_color = self::WHITE; + $n_main_color = self::WHITE; + $n_secondary_color = self::SCARLET; + break; + } + if (!$rev) { + $main_text_color = self::SCARLET; + $secondary_text_color = self::BLACK; + $n_main_color = self::SCARLET; + $n_secondary_color = self::WHITE; + $clover_color = self::FOUR_H_GREEN; + } else { + $main_text_color = self::WHITE; + $secondary_text_color = self::WHITE; + $n_main_color = self::SCARLET; + $n_secondary_color = self::WHITE; + $clover_color = self::WHITE; + } + break; + case 'pms186cp': + if (!$rev) { + $main_text_color = self::PANTONE_RED; + $secondary_text_color = self::PANTONE_RED; + $n_main_color = self::PANTONE_RED; + $n_secondary_color = self::WHITE; + $clover_color = self::FOUR_H_GREEN; + } else { + $main_text_color = self::WHITE; + $secondary_text_color = self::WHITE; + $n_main_color = self::PANTONE_RED; + $n_secondary_color = self::WHITE; + $clover_color = self::WHITE; + $clover_h_color = self::BLACK; + } + break; + case '4c': + if (!$rev) { + $main_text_color = self::CMYK_RED; + $secondary_text_color = self::BLACK; + $n_main_color = self::CMYK_RED; + $n_secondary_color = self::WHITE; + $clover_color = self::FOUR_H_GREEN; + } else { + $main_text_color = self::WHITE; + $secondary_text_color = self::WHITE; + $n_main_color = self::CMYK_RED; + $n_secondary_color = self::WHITE; + $clover_color = self::WHITE; + $clover_h_color = self::BLACK; + } + break; + case 'blk': + if (!$rev) { + $main_text_color = self::BLACK; + $secondary_text_color = self::BLACK; + $n_main_color = self::BLACK; + $n_secondary_color = self::WHITE; + $clover_color = self::BLACK; + } else { + $main_text_color = self::WHITE; + $secondary_text_color = self::WHITE; + $n_main_color = self::WHITE; + $n_secondary_color = self::BLACK; + $clover_color = self::WHITE; + } + break; + default: + break; + } + + if (!isset($clover_h_color)) { + $clover_h_color = $n_secondary_color; + } + + if ($preview) { + $svg->addAttribute("class", "preview"); + } + + $svg_file = new SvgFile; + + if ($orient == 'horiz') { + switch ($template) { + case 'org_only': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(12); + $svg->setFontColor($main_text_color); + $svg->addText($lockup->org_name, 44, 7.75); + $text_width = $svg->textDimensions($lockup->org_name)[0]; + + $svg->addAttribute('viewBox', "0 0 " . ($text_width + 44) . " 36"); + $svg_file->height = 36; + $svg_file->width = $text_width + 44; + if (!$preview) { + $svg->addAttribute('height', 36); + $svg->addAttribute('width', $text_width + 44); + } + break; + case 'org_two_line': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(12); + $svg->setFontColor($main_text_color); + $svg->addText($lockup->org_name, 44, 2.25); + $main_text_width = $svg->textDimensions($lockup->org_name)[0]; + + $svg->addText($lockup->org_second_line, 44, 13.25); + $secondary_text_width = $svg->textDimensions($lockup->org_second_line)[0]; + + $svg->addAttribute('viewBox', "0 0 " . (max($main_text_width, $secondary_text_width) + 44) . " 36"); + $svg_file->height = 36; + $svg_file->width = max($main_text_width, $secondary_text_width) + 44; + if (!$preview) { + $svg->addAttribute('height', 36); + $svg->addAttribute('width', max($main_text_width, $secondary_text_width) + 44); + } + break; + case 'org_subject': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(12); + $svg->setFontColor($main_text_color); + $svg->addText($lockup->org_name, 44, 7.75); + $main_text_width = $svg->textDimensions($lockup->org_name)[0]; + + $svg->setFontSVG(self::MERCURY); + $svg->setLetterSpacing(0); + $svg->setFontSize(8.125); + $svg->setFontColor($secondary_text_color); + $svg->addText($lockup->subject, 44, 26); + $secondary_text_width = $svg->textDimensions($lockup->subject)[0]; + + $svg->addAttribute('viewBox', "0 0 " . (max($main_text_width, $secondary_text_width) + 44) . " 38"); + $svg_file->height = 38; + $svg_file->width = max($main_text_width, $secondary_text_width) + 44; + if (!$preview) { + $svg->addAttribute('height', 38); + $svg->addAttribute('width', max($main_text_width, $secondary_text_width) + 44); + } + break; + case 'org_recognized_student': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(12); + $svg->setFontColor($main_text_color); + $svg->addText($lockup->org_name, 44, 7.75); + $main_text_width = $svg->textDimensions($lockup->org_name)[0]; + + $svg->setFontSVG(self::MERCURY); + $svg->setLetterSpacing(0); + $svg->setFontSize(8.125); + $svg->setFontColor($secondary_text_color); + $svg->addText('Recognized Student Organization', 44, 26); + $secondary_text_width = $svg->textDimensions('Recognized Student Organization')[0]; + + $svg->addAttribute('viewBox', "0 0 " . (max($main_text_width, $secondary_text_width) + 44) . " 38"); + $svg_file->height = 38; + $svg_file->width = max($main_text_width, $secondary_text_width) + 44; + if (!$preview) { + $svg->addAttribute('height', 38); + $svg->addAttribute('width', max($main_text_width, $secondary_text_width) + 44); + } + break; + case 'org_subject_1_2': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(12); + $svg->setFontColor($main_text_color); + $svg->addText($lockup->org_name, 44, -5.8); + $main_text_width = $svg->textDimensions($lockup->org_name)[0]; + + $svg->setFontSVG(self::MERCURY); + $svg->setLetterSpacing(0); + $svg->setFontSize(8.125); + $svg->setFontColor($secondary_text_color); + $svg->addText($lockup->subject, 44, 17); + $secondary_text_width = $svg->textDimensions($lockup->subject)[0]; + + $svg->addText($lockup->subject_second_line, 44, 26); + $third_width = $svg->textDimensions($lockup->subject_second_line)[0]; + + $svg->addAttribute('viewBox', "0 0 " . (max($main_text_width, $secondary_text_width, $third_width) + 44) . " 38"); + $svg_file->height = 38; + $svg_file->width = max($main_text_width, $secondary_text_width, $third_width) + 44; + if (!$preview) { + $svg->addAttribute('height', 38); + $svg->addAttribute('width', max($main_text_width, $secondary_text_width, $third_width) + 44); + } + break; + case 'org_subject_2_1': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(12); + $svg->setFontColor($main_text_color); + $svg->addText($lockup->org_name, 44, -5.8); + $main_text_width = $svg->textDimensions($lockup->org_name)[0]; + + $svg->addText($lockup->org_second_line, 44, 5.2); + $third_width = $svg->textDimensions($lockup->org_second_line)[0]; + + $svg->setFontSVG(self::MERCURY); + $svg->setLetterSpacing(0); + $svg->setFontSize(8.125); + $svg->setFontColor($secondary_text_color); + $svg->addText($lockup->subject, 44, 26); + $secondary_text_width = $svg->textDimensions($lockup->subject)[0]; + + $svg->addAttribute('viewBox', "0 0 " . (max($main_text_width, $secondary_text_width, $third_width) + 44) . " 38"); + $svg_file->height = 38; + $svg_file->width = max($main_text_width, $secondary_text_width, $third_width) + 44; + if (!$preview) { + $svg->addAttribute('height', 38); + $svg->addAttribute('width', max($main_text_width, $secondary_text_width, $third_width) + 44); + } + break; + case 'org_subject_2_2': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(12); + $svg->setFontColor($main_text_color); + $svg->addText($lockup->org_name, 44, -5.8); + $main_text_width = $svg->textDimensions($lockup->org_name)[0]; + + $svg->addText($lockup->org_second_line, 44, 4.2); + $third_width = $svg->textDimensions($lockup->org_second_line)[0]; + + $svg->setFontSVG(self::MERCURY); + $svg->setLetterSpacing(0); + $svg->setFontSize(7); + $svg->setFontColor($secondary_text_color); + $svg->addText($lockup->subject, 44, 19); + $secondary_text_width = $svg->textDimensions($lockup->subject)[0]; + + $svg->addText($lockup->subject_second_line, 44, 27); + $fourth_width = $svg->textDimensions($lockup->subject_second_line)[0]; + + $svg->addAttribute('viewBox', "0 0 " . (max($main_text_width, $secondary_text_width, $third_width, $fourth_width) + 44) . " 38"); + $svg_file->height = 38; + $svg_file->width = max($main_text_width, $secondary_text_width, $third_width, $fourth_width) + 44; + if (!$preview) { + $svg->addAttribute('height', 38); + $svg->addAttribute('width', max($main_text_width, $secondary_text_width, $third_width, $fourth_width) + 44); + } + break; + case 'acronym': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(22); + $svg->setFontColor($main_text_color); + $svg->addText($lockup->acronym, 44, -0.5); + $text_width = $svg->textDimensions($lockup->acronym)[0]; + + $svg->addAttribute('viewBox', "0 0 " . ($text_width + 44) . " 36"); + $svg_file->height = 38; + $svg_file->width = $text_width + 44; + if (!$preview) { + $svg->addAttribute('height', 36); + $svg->addAttribute('width', $text_width + 44); + } + break; + case 'acronym_subject': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(22); + $svg->setFontColor($main_text_color); + $svg->addText($lockup->acronym, 44, -10.5); + $main_text_width = $svg->textDimensions($lockup->acronym)[0]; + + $svg->setFontSize(16.25); + $svg->setFontColor($secondary_text_color); + $svg->addText($lockup->acronym_subject, 44, 16.25); + $secondary_text_width = $svg->textDimensions($lockup->acronym_subject)[0]; + + $svg->addAttribute('viewBox', "0 0 " . (max($main_text_width, $secondary_text_width) + 44) . " 40"); + $svg_file->height = 40; + $svg_file->width = max($main_text_width, $secondary_text_width) + 44; + if (!$preview) { + $svg->addAttribute('height', 40); + $svg->addAttribute('width', max($main_text_width, $secondary_text_width) + 44); + } + break; + case 'extension': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(22); + $svg->setFontColor($main_text_color); + $svg->addText('EXTENSION', 44, -0.5); + $main_text_width = $svg->textDimensions('EXTENSION')[0]; + + $svg->setFontSVG(self::MERCURY); + $svg->setLetterSpacing(0); + $svg->setFontSize(8.125); + $svg->setFontColor($secondary_text_color); + $svg->addText($lockup->extension_county, 44, 26); + $secondary_text_width = $svg->textDimensions($lockup->extension_county)[0]; + + $svg->addAttribute('viewBox', "0 0 " . (max($main_text_width, $secondary_text_width) + 44) . " 38"); + $svg_file->height = 38; + $svg_file->width = max($main_text_width, $secondary_text_width) + 44; + if (!$preview) { + $svg->addAttribute('height', 38); + $svg->addAttribute('width', max($main_text_width, $secondary_text_width) + 44); + } + break; + case 'ncta': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(22); + $svg->setFontColor($main_text_color); + $svg->addText('NCTA', 44, -0.5); + $main_text_width = $svg->textDimensions('NCTA')[0]; + + $svg->setFontSVG(self::MERCURY); + $svg->setLetterSpacing(0); + $svg->setFontSize(8.125); + $svg->setFontColor($secondary_text_color); + $svg->addText($lockup->subject, 44, 26); + $secondary_text_width = $svg->textDimensions($lockup->subject)[0]; + + $svg->addAttribute('viewBox', "0 0 " . (max($main_text_width, $secondary_text_width) + 44) . " 38"); + $svg_file->height = 38; + $svg_file->width = max($main_text_width, $secondary_text_width) + 44; + if (!$preview) { + $svg->addAttribute('height', 38); + $svg->addAttribute('width', max($main_text_width, $secondary_text_width) + 44); + } + break; + } + + $svg->addPath(self::HORIZ_N_R_CIRCLE, array('fill' => $n_main_color)); + if (!($style == 'blk' && $rev)) { + $svg->addPath(self::HORIZ_N_R_FILL, array('fill' => $n_secondary_color)); + $svg->addPath(self::HORIZ_N_SERIF, array('fill' => $n_secondary_color)); + } + $svg->addPath(self::HORIZ_N_FILL, array('fill' => $n_main_color)); + $svg->addPath(self::HORIZ_N_OUTLINE_R, array('fill' => $n_main_color)); + } else if ($orient == 'vert') { + switch ($template) { + case 'org_only': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(12); + $svg->setFontColor($main_text_color); + $text_width = $svg->textDimensions($lockup->org_name)[0]; + $svg->addText($lockup->org_name, 100 - ($text_width / 2), 37); + break; + case 'org_two_line': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(12); + $svg->setFontColor($main_text_color); + $text_width = $svg->textDimensions($lockup->org_name)[0]; + $svg->addText($lockup->org_name, 100 - ($text_width / 2), 37); + + $text_width = $svg->textDimensions($lockup->org_second_line)[0]; + $svg->addText($lockup->org_second_line, 100 - ($text_width / 2), 48); + break; + case 'org_subject': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(12); + $svg->setFontColor($main_text_color); + $text_width = $svg->textDimensions($lockup->org_name)[0]; + $svg->addText($lockup->org_name, 100 - ($text_width / 2), 37); + + $svg->setFontSVG(self::MERCURY); + $svg->setLetterSpacing(0); + $svg->setFontSize(8.125); + $svg->setFontColor($secondary_text_color); + $text_width = $svg->textDimensions($lockup->subject)[0]; + $svg->addText($lockup->subject, 100 - ($text_width / 2), 55); + break; + case 'org_recognized_student': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(12); + $svg->setFontColor($main_text_color); + $text_width = $svg->textDimensions($lockup->org_name)[0]; + $svg->addText($lockup->org_name, 100 - ($text_width / 2), 37); + + $svg->setFontSVG(self::MERCURY); + $svg->setLetterSpacing(0); + $svg->setFontSize(8.125); + $svg->setFontColor($secondary_text_color); + $text_width = $svg->textDimensions('Recognized Student Organization')[0]; + $svg->addText('Recognized Student Organization', 100 - ($text_width / 2), 55); + break; + case 'org_subject_1_2': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(12); + $svg->setFontColor($main_text_color); + $text_width = $svg->textDimensions($lockup->org_name)[0]; + $svg->addText($lockup->org_name, 100 - ($text_width / 2), 37); + + $svg->setFontSVG(self::MERCURY); + $svg->setLetterSpacing(0); + $svg->setFontSize(8.125); + $svg->setFontColor($secondary_text_color); + $text_width = $svg->textDimensions($lockup->subject)[0]; + $svg->addText($lockup->subject, 100 - ($text_width / 2), 55); + + $text_width = $svg->textDimensions($lockup->subject_second_line)[0]; + $svg->addText($lockup->subject_second_line, 100 - ($text_width / 2), 64); + break; + case 'org_subject_2_1': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(12); + $svg->setFontColor($main_text_color); + $text_width = $svg->textDimensions($lockup->org_name)[0]; + $svg->addText($lockup->org_name, 100 - ($text_width / 2), 37); + + $text_width = $svg->textDimensions($lockup->org_second_line)[0]; + $svg->addText($lockup->org_second_line, 100 - ($text_width / 2), 48); + + $svg->setFontSVG(self::MERCURY); + $svg->setLetterSpacing(0); + $svg->setFontSize(8.125); + $svg->setFontColor($secondary_text_color); + $text_width = $svg->textDimensions($lockup->subject)[0]; + $svg->addText($lockup->subject, 100 - ($text_width / 2), 66); + break; + case 'org_subject_2_2': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(12); + $svg->setFontColor($main_text_color); + $text_width = $svg->textDimensions($lockup->org_name)[0]; + $svg->addText($lockup->org_name, 100 - ($text_width / 2), 37); + + $text_width = $svg->textDimensions($lockup->org_second_line)[0]; + $svg->addText($lockup->org_second_line, 100 - ($text_width / 2), 48); + + $svg->setFontSVG(self::MERCURY); + $svg->setLetterSpacing(0); + $svg->setFontSize(8.125); + $svg->setFontColor($secondary_text_color); + $text_width = $svg->textDimensions($lockup->subject)[0]; + $svg->addText($lockup->subject, 100 - ($text_width / 2), 61); + + $text_width = $svg->textDimensions($lockup->subject_second_line)[0]; + $svg->addText($lockup->subject_second_line, 100 - ($text_width / 2), 70); + break; + case 'acronym': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(22); + $svg->setFontColor($main_text_color); + $text_width = $svg->textDimensions($lockup->acronym)[0]; + $svg->addText($lockup->acronym, 100 - ($text_width / 2), 32); + break; + case 'acronym_social': + $svg->addPath(self::VERT_BACKGROUND, array('fill' => $n_secondary_color)); + + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(22); + $svg->setFontColor($main_text_color); + $text_width = $svg->textDimensions($lockup->acronym)[0]; + $svg->addText($lockup->acronym, 100 - ($text_width / 2), 32); + break; + case 'acronym_subject': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(22); + $svg->setFontColor($main_text_color); + $text_width = $svg->textDimensions($lockup->acronym)[0]; + $svg->addText($lockup->acronym, 100 - ($text_width / 2), 32); + + $svg->setFontSize(16.25); + $svg->setFontColor($secondary_text_color); + $text_width = $svg->textDimensions($lockup->acronym_subject)[0]; + $svg->addText($lockup->acronym_subject, 100 - ($text_width / 2), 56.25); + break; + case 'acronym_subject_2_1': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(22); + $svg->setFontColor($main_text_color); + $text_width = $svg->textDimensions($lockup->acronym)[0]; + $svg->addText($lockup->acronym, 100 - ($text_width / 2), 32); + $text_width = $svg->textDimensions($lockup->acronym_second_line)[0]; + $svg->addText($lockup->acronym_second_line, 100 - ($text_width / 2), 52); + + $svg->setFontSize(16.25); + $svg->setFontColor($secondary_text_color); + $text_width = $svg->textDimensions($lockup->acronym_subject)[0]; + $svg->addText($lockup->acronym_subject, 100 - ($text_width / 2), 80); + break; + case 'extension': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(22); + $svg->setFontColor($main_text_color); + $text_width = $svg->textDimensions('EXTENSION')[0]; + $svg->addText('EXTENSION', 100 - ($text_width / 2), 32); + + $svg->setFontSVG(self::MERCURY); + $svg->setLetterSpacing(0); + $svg->setFontSize(8.125); + $svg->setFontColor($secondary_text_color); + $text_width = $svg->textDimensions($lockup->extension_county)[0]; + $svg->addText($lockup->extension_county, 100 - ($text_width / 2), 60); + break; + case 'ncta': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(22); + $svg->setFontColor($main_text_color); + $text_width = $svg->textDimensions('NCTA')[0]; + $svg->addText('NCTA', 100 - ($text_width / 2), 32); + + $svg->setFontSVG(self::MERCURY); + $svg->setLetterSpacing(0); + $svg->setFontSize(8.125); + $svg->setFontColor($secondary_text_color); + $text_width = $svg->textDimensions($lockup->subject)[0]; + $svg->addText($lockup->subject, 100 - ($text_width / 2), 60); + break; + case 'extension_4h': + $svg->setFontSVG(self::TUNGSTEN); + $svg->setLetterSpacing(0.05); + $svg->setFontSize(28); + $svg->setFontColor($main_text_color); + $text_width = $svg->textDimensions('EXTENSION')[0]; + $svg->addText('EXTENSION', 100 - ($text_width / 2), 32); + + $svg->setFontSVG(self::MERCURY); + $svg->setLetterSpacing(0); + $svg->setFontSize(8.125); + $svg->setFontColor($secondary_text_color); + $text_width = $svg->textDimensions($lockup->extension_county)[0]; + $svg->addText($lockup->extension_county, 100 - ($text_width / 2), 66); + break; + } + + $height = 80; + $width = 200; + $x = 0; + $y = 0; + switch ($template) { + case 'org_subject_2_2': + $height = 88; + break; + case 'acronym_subject_2_1': + $height = 104; + break; + case 'acronym_social': + $height = 100; + $width = 100; + $y = -20; + $x = 50; + break; + } + + $svg->addAttribute('viewBox', $x . " " . $y . " " . ($width) . " " . ($height)); + $svg_file->height = $height; + $svg_file->width = $width; + if (!$preview) { + $svg->addAttribute('height', $height); + $svg->addAttribute('width', $width); + } + + if ($template == 'extension_4h') { + $svg->addPath(self::LEFT_N_R_CIRCLE, array('fill' => $n_main_color, 'transform' => 'translate(50.5 0.1)')); + if (!($style == 'blk' && $rev)) { + $svg->addPath(self::LEFT_N_R_FILL, array('fill' => $n_secondary_color, 'transform' => 'translate(50.5 0.1)')); + $svg->addPath(self::LEFT_N_SERIF, array('fill' => $n_secondary_color, 'transform' => 'translate(50.5 0.1)')); + } + $svg->addPath(self::LEFT_N_OUTLINE, array('fill' => $n_main_color, 'transform' => 'translate(50.5 0.1)')); + $svg->addPath(self::LEFT_N_FILL, array('fill' => $n_main_color, 'transform' => 'translate(56, 0)')); + $svg->addPath(self::LEFT_N_OUTLINE_R, array('fill' => $n_main_color, 'transform' => 'translate(50.5 0.1)')); + + $svg->addPath(self::RIGHT_CLOVER_FILL, array('fill' => $clover_color, 'transform' => 'translate(144.6758,24.75) rotate(180) scale(-1,1)')); + $svg->addPath(self::RIGHT_CLOVER_LETTER_1, array('fill' => $clover_color, 'transform' => 'translate(140.91,34.26) rotate(180) scale(-1,1)')); + $svg->addPath(self::RIGHT_CLOVER_LETTER_2, array('fill' => $clover_color, 'transform' => 'translate(140.737,33.5) rotate(180) scale(-1,1)')); + $svg->addPath(self::RIGHT_CLOVER_LETTER_3, array('fill' => $clover_color, 'transform' => 'translate(141.0319,32.28) rotate(180) scale(-1,1)')); + $svg->addPath(self::RIGHT_CLOVER_LETTER_4, array('fill' => $clover_color, 'transform' => 'translate(142.26,31.9) rotate(180) scale(-1,1)')); + $svg->addPath(self::RIGHT_CLOVER_LETTER_5, array('fill' => $clover_color, 'transform' => 'translate(143.3116,30.35) rotate(180) scale(-1,1)')); + $svg->addPath(self::RIGHT_CLOVER_LETTER_6, array('fill' => $clover_color, 'transform' => 'translate(143.4054,29.43) rotate(180) scale(-1,1)')); + $svg->addPath(self::RIGHT_CLOVER_LETTER_7, array('fill' => $clover_color, 'transform' => 'translate(143.971,28.3368) rotate(180) scale(-1,1)')); + $svg->addPath(self::RIGHT_CLOVER_LETTER_8, array('fill' => $clover_color, 'transform' => 'translate(144.4453,28.0718) rotate(180) scale(-1,1)')); + $svg->addPath(self::RIGHT_CLOVER_H_1, array('fill' => $clover_h_color, 'transform' => 'translate(56, 0)')); + $svg->addPath(self::RIGHT_CLOVER_H_2, array('fill' => $clover_h_color, 'transform' => 'translate(56, 0)')); + $svg->addPath(self::RIGHT_CLOVER_H_3, array('fill' => $clover_h_color, 'transform' => 'translate(56, 0)')); + $svg->addPath(self::RIGHT_CLOVER_H_4, array('fill' => $clover_h_color, 'transform' => 'translate(56, 0)')); + + $svg->addPath(self::CENTER_DIVIDER, array('fill' => $secondary_text_color, 'transform' => 'translate(50.5 0.1)', 'stroke' => $secondary_text_color, 'stroke-width' => '0.5pt')); + } else { + $svg->addPath(self::VERT_N_R_CIRCLE, array('fill' => $n_main_color)); + if (!($style == 'blk' && $rev)) { + $svg->addPath(self::VERT_N_R_FILL, array('fill' => $n_secondary_color)); + $svg->addPath(self::VERT_N_SERIF, array('fill' => $n_secondary_color)); + } + $svg->addPath(self::VERT_N_FILL, array('fill' => $n_main_color)); + $svg->addPath(self::VERT_N_OUTLINE_R, array('fill' => $n_main_color)); + } + } + + $svg_file->svg_text = $svg->asXML(); + + return $svg_file; + } } \ No newline at end of file diff --git a/src/Views/new_lockup.php b/src/Views/new_lockup.php index d8f60aa36de4bbe473378ea1016fbb6ae8960db0..ee36ed22882ec5b984b5cb9a0e4ecd6cbaa8da68 100644 --- a/src/Views/new_lockup.php +++ b/src/Views/new_lockup.php @@ -24,7 +24,7 @@ </div> </div> <br> - <div class="dcf-grid-full dcf-grid-halves@sm dcf-col-gap-vw"> + <div class="dcf-grid-full dcf-grid-halves@sm dcf-grid-thirds@lg dcf-col-gap-vw dcf-row-gap-10 dcf-txt-sm"> <div> <label> <input type="radio" name="type" value="org_only" id="type-org-only" <?php if ($context->lockup->style == 'org_only' || empty($context->lockup->style)) echo 'checked="checked"'; ?>> @@ -33,7 +33,7 @@ </label><br> <label for="type-org-only"> Primary ID lockup (A): primary hierarchy for your full College, Department, Unit or Subject name in a single line design. - </label><br><br> + </label> </div> <div> <label> @@ -44,10 +44,8 @@ <label for="type-org-two-line"> Primary ID lockup (B): primary hierarchy for your full College, Department, Unit or Subject name in a two-line design. <br><em>*Additional line should be used when ID is too long to fit on one line.</em> - </label><br><br> + </label> </div> - </div> - <div class="dcf-grid-full dcf-grid-halves@sm dcf-col-gap-vw"> <div> <label> <input type="radio" name="type" value="org_subject" id="type-org-subject" <?php if ($context->lockup->style == 'org_subject') echo 'checked="checked"'; ?>> @@ -56,7 +54,7 @@ </label><br> <label for="type-org-subject"> Primary and Secondary ID lockup (A): primary and secondary hierarchy for your full College, Department, Unit or Subject name in a single line design. - </label><br><br> + </label> </div> <div> <label> @@ -67,10 +65,18 @@ <label for="type-org-subject-1-2"> Primary and Secondary ID lockup (B): primary hierarchy for your full College, Department, Unit or Subject name in one line and secondary hierarchy in a two-line design. <br><em>*Additional line should be used when ID is too long to fit on one line.</em> - </label><br><br> + </label> + </div> + <div> + <label> + <input type="radio" name="type" value="org_recognized_student" id="type-org-recognized-student" <?php if ($context->lockup->style == 'org_recognized_student') echo 'checked="checked"'; ?>> + <img class="horiz height-38" src="<?php echo $context->baseURL; ?>images/org_recognized_student_example.png" role="presentation"> + <img class="vert" style="display: none;" src="<?php echo $context->baseURL; ?>images/org_recognized_student_vert_example.png" role="presentation"> + </label><br> + <label for="type-org-recognized-student"> + Recognized Student Organization lockup: primary and secondary hierarchy for your recognized student organization name in a single line design. + </label> </div> - </div> - <div class="dcf-grid-full dcf-grid-halves@sm dcf-col-gap-vw"> <div> <label> <input type="radio" name="type" value="org_subject_2_1" id="type-org-subject-2-1" <?php if ($context->lockup->style == 'org_subject_2_1') echo 'checked="checked"'; ?>> @@ -80,7 +86,7 @@ <label for="type-org-subject-2-1"> Primary and Secondary ID lockup (C): primary hierarchy for your full College, Department, Unit or Subject name in two lines and secondary hierarchy in a single line design. <br><em>*Additional line should be used when ID is too long to fit on one line.</em> - </label><br><br> + </label> </div> <div> <label> @@ -91,10 +97,8 @@ <label for="type-org-subject-2-2"> Primary and Secondary ID lockup (D): primary hierarchy for your full College, Department, Unit or Subject name in two lines and secondary hierarchy in a two-line design. <br><em>*Additional line should be used when ID is too long to fit on one line.</em> - </label><br><br> + </label> </div> - </div> - <div class="dcf-grid-full dcf-grid-halves@sm dcf-col-gap-vw"> <div> <label> <input type="radio" name="type" value="acronym" id="type-acronym" <?php if ($context->lockup->style == 'acronym') echo 'checked="checked"'; ?>> @@ -104,7 +108,7 @@ <label for="type-acronym"> Merchandise lockup* (A): primary hierarchy for the shorthand abbreviation of your College, Department, Unit or Subject name in a single line, short character design. Use this version also to create casual lockups for social media. i.e. CASNR, IANR, COJMC. <br><em>*Restricted to merchandise and social media use only.</em> - </label><br><br> + </label> </div> <div> <label> @@ -114,10 +118,8 @@ </label><br> <label for="type-acronym-subject""> Merchandise lockup (B): primary and secondary hierarchy for the shorthand abbreviation of your College, Department, Unit or Subject name in a single line, short character design. Restricted to merchandise use only. i.e. CASNR/ALEC, CEHS/CYFS. - </label><br><br> + </label> </div> - </div> - <div class="dcf-grid-full dcf-grid-halves@sm dcf-col-gap-vw"> <div> <label> <input type="radio" name="type" value="acronym_subject_2_1" id="type-acronym-subject-2-1" <?php if ($context->lockup->style == 'acronym_subject_2_1') echo 'checked="checked"'; ?>> @@ -128,7 +130,7 @@ Embroidery lockup: primary hierarchy for your full College, Department, Unit or Subject name in two lines and secondary hierarchy in a single and optional two-line design.* <br><em>*Embroidery requires larger text, so we recommend keeping text to a minimum and as few lines of text as possible.</em> <br><em>**This lockup is vertical style ONLY.</em> - </label><br><br> + </label> </div> <div> <label> @@ -138,19 +140,7 @@ </label><br> <label for="type-extension"> Extension lockup: primary hierarchy for Extension and secondary hierarchy for the counties in a single line design. - </label><br><br> - </div> - </div> - <div class="dcf-grid-full dcf-grid-halves@sm dcf-col-gap-vw"> - <div> - <label> - <input type="radio" name="type" value="ncta" id="type-ncta" <?php if ($context->lockup->style == 'ncta') echo 'checked="checked"'; ?>> - <img class="horiz height-38" src="<?php echo $context->baseURL; ?>images/ncta_example.png" role="presentation"> - <img class="vert" style="display: none;" src="<?php echo $context->baseURL; ?>images/ncta_vert_example.png" role="presentation"> - </label><br> - <label for="type-extension"> - NCTA lockup: primary hierarchy for NCTA and secondary hierarchy for the subject in a single line design. - </label><br><br> + </label> </div> <div> <label> @@ -161,10 +151,18 @@ <label for="type-extension-4h"> Extension/4H lockup: primary hierarchy for Extension and secondary hierarchy for the counties in a single line design. 4H logo included. <br><em>*This lockup is vertical style ONLY.</em> - </label><br><br> + </label> + </div> + <div> + <label> + <input type="radio" name="type" value="ncta" id="type-ncta" <?php if ($context->lockup->style == 'ncta') echo 'checked="checked"'; ?>> + <img class="horiz height-38" src="<?php echo $context->baseURL; ?>images/ncta_example.png" role="presentation"> + <img class="vert" style="display: none;" src="<?php echo $context->baseURL; ?>images/ncta_vert_example.png" role="presentation"> + </label><br> + <label for="type-extension"> + NCTA lockup: primary hierarchy for NCTA and secondary hierarchy for the subject in a single line design. + </label> </div> - </div> - <div class="dcf-grid-full dcf-grid-halves@sm dcf-col-gap-vw"> <div> <label class="center"> <input type="radio" name="type" value="acronym_social" id="type-acronym-social" <?php if ($context->lockup->style == 'acronym_social') echo 'checked="checked"'; ?>> @@ -174,7 +172,7 @@ <label for="type-acronym-social"> Social lockup: primary hierarchy for the shorthand abbreviation of your College, Department, Unit or Subject name in a single line, short character design. <br><em>*This lockup is vertical style ONLY.</em> - </label><br><br> + </label> </div> </div> </fieldset> @@ -389,6 +387,15 @@ require(['jquery'], function ($) { $('#acronym-second-line-field').hide(); $('#acronym-subject-field').hide(); $('#extension-county-field').hide(); + } else if ($('#type-org-recognized-student').is(':checked')) { + $('#organization-field').show(); + $('#organization-second-line-field').hide(); + $('#subject-field').hide(); + $('#subject-second-line-field').hide(); + $('#acronym-field').hide(); + $('#acronym-second-line-field').hide(); + $('#acronym-subject-field').hide(); + $('#extension-county-field').hide(); } else if ($('#type-org-subject-2-1').is(':checked')) { $('#organization-field').show(); $('#organization-second-line-field').show(); diff --git a/src/Views/preview_lockup.php b/src/Views/preview_lockup.php index cf6c7b93fd8f01c206426134cd92d7c63aa0b67d..6fe27a1debf88467d7037b0a8574f94c1269d3d5 100644 --- a/src/Views/preview_lockup.php +++ b/src/Views/preview_lockup.php @@ -1,6 +1,6 @@ <div class="dcf-bleed dcf-pt-8 dcf-pb-8"> <div class="dcf-wrapper"> - <h3 class="page-title">Preview for "<?php echo $context->lockup->getName() ?>" Lockup</h3> + <h3 class="page-title">Preview for "<?php echo trim($context->lockup->getName()) ?>" Lockup</h3> <div class="dcf-grid-full dcf-grid-halves@sm dcf-col-gap-vw dcf-txt-center"> <div class="center"> <?php if ($context->lockup->style != 'acronym_subject_2_1' && $context->lockup->style != 'acronym_social' && $context->lockup->style != 'extension_4h'): ?>