/** * Up **/ public function up() { if ($this->db->tableExists('#__xorganization_types')) { $query = "SELECT COUNT(*) FROM `#__xorganization_types`"; $this->db->setQuery($query); if (!$this->db->loadResult()) { $types = array('universityundergraduate' => 'University / College Undergraduate', 'universitygraduate' => 'University / College Graduate Student', 'universityfaculty' => 'University / College Faculty', 'universitystaff' => 'University / College Staff', 'precollegestudent' => 'K-12 (Pre-College) Student', 'precollegefacultystaff' => 'K-12 (Pre-College) Faculty/Staff', 'nationallab' => 'National Laboratory', 'industry' => 'Industry / Private Company', 'government' => 'Government Agency', 'military' => 'Military', 'unemployed' => 'Retired / Unemployed'); include_once PATH_CORE . DS . 'components' . DS . 'com_members' . DS . 'tables' . DS . 'organizationtype.php'; foreach ($types as $alias => $title) { $row = new \Components\Members\Tables\OrganizationType($this->db); $row->type = $alias; $row->title = $title; $row->store(); } } } }
<?php if ($this->registration->Employment != REG_HIDE && $this->profile->get('orgtype')) { ?> <?php if ($this->params->get('access_orgtype') == 0 || $this->params->get('access_orgtype') == 1 && $loggedin || $this->params->get('access_orgtype') == 2 && $isUser) { ?> <li class="profile-orgtype field"> <div class="field-content"> <div class="key"><?php echo Lang::txt('PLG_GROUPS_PROFILE_EMPLOYMENT_TYPE'); ?> </div> <?php //get organization types from db include_once PATH_CORE . DS . 'components' . DS . 'com_members' . DS . 'tables' . DS . 'organizationtype.php'; $xot = new \Components\Members\Tables\OrganizationType($database); $orgtypes = $xot->find('list'); //output value $orgtype = $this->escape($this->profile->get('orgtype')); foreach ($orgtypes as $ot) { $orgtype = $ot->type == $this->profile->get('orgtype') ? $this->escape($ot->title) : $orgtype; } ?> <div class="value"> <?php echo $orgtype; ?> </div> </div> </li> <?php
?> :</label><br /> <select name="profile[orgtype]" id="field-orgtype"> <option value=""<?php if (!$this->profile->get('orgtype')) { echo ' selected="selected"'; } ?> ><?php echo Lang::txt('COM_MEMBERS_SELECT'); ?> </option> <?php include_once PATH_CORE . DS . 'components' . DS . 'com_members' . DS . 'tables' . DS . 'organizationtype.php'; $database = App::get('db'); $rot = new \Components\Members\Tables\OrganizationType($database); if ($types = $rot->find('list')) { foreach ($types as $orgtype) { echo '<option value="' . $this->escape($orgtype->type) . '"'; if ($this->profile->get('orgtype') == $orgtype->type) { echo ' selected="selected"'; } echo '>' . $this->escape(stripslashes($orgtype->title)) . '</option>' . "\n"; } } ?> </select> </div> <div class="input-wrap"> <label for="field-organization"><?php echo Lang::txt('COM_MEMBERS_FIELD_ORGANIZATION');
<fieldset> <legend><?php echo Lang::txt('COM_MEMBERS_REGISTER_LEGEND_PERSONAL_INFO'); ?> </legend> <?php if ($this->registrationEmployment != REG_HIDE) { ?> <?php $message = !empty($this->xregistration->_invalid['orgtype']) ? '<span class="error">' . $this->xregistration->_invalid['orgtype'] . '</span>' : ''; $fieldclass = $message ? ' class="fieldWithErrors"' : ''; include_once PATH_CORE . DS . 'components' . DS . 'com_members' . DS . 'tables' . DS . 'organizationtype.php'; $database = App::get('db'); $rot = new \Components\Members\Tables\OrganizationType($database); $types = $rot->find('list'); ?> <label for="orgtype"<?php echo $fieldclass; ?> > <?php echo Lang::txt('COM_MEMBERS_REGISTER_EMPLOYMENT_TYPE'); ?> : <?php echo $this->registrationEmployment == REG_REQUIRED ? '<span class="required">' . Lang::txt('COM_MEMBERS_REGISTER_FORM_REQUIRED') . '</span>' : ''; ?> <select name="orgtype" id="orgtype"> <?php if (empty($this->registration['orgtype']) || !empty($this->xregistration->_invalid['orgtype'])) {