public function init() { // Set the custom decorator $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator'); $translate = Shineisp_Registry::get('Zend_Translate'); $this->addElement('text', 'domain', array('filters' => array('StringTrim'), 'required' => true, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Domain'), 'description' => $translate->_('Write down the name of the domain without any extension, white spaces, or symbols.'), 'class' => 'form-control updatechkdomain')); $this->addElement('select', 'tld_id', array('label' => $translate->_('TLD'), 'description' => $translate->_('Select the TLD from the list'), 'decorators' => array('Bootstrap'), 'class' => 'form-control updatechkdomain')); $this->getElement('tld_id')->setAllowEmpty(false)->setMultiOptions(DomainsTlds::getList())->setRequired(true); $this->addElement('select', 'registrars_id', array('label' => $translate->_('Registrar'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('registrars_id')->setAllowEmpty(true)->setMultiOptions(Registrars::getList()); // Domain Ownership $this->addElement('select', 'owner', array('label' => $translate->_('Owner'), 'description' => $translate->_("If the domain owner's profile is not set, the domain customer information will be used."), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('owner')->setAllowEmpty(true)->setMultiOptions(DomainsProfiles::getList(true)); $this->addElement('select', 'admin', array('label' => $translate->_('Admin-C'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('admin')->setAllowEmpty(true)->setMultiOptions(DomainsProfiles::getList(true)); $this->addElement('select', 'tech', array('label' => $translate->_('Tech'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('tech')->setAllowEmpty(true)->setMultiOptions(DomainsProfiles::getList(true)); $this->addElement('select', 'billing', array('label' => $translate->_('Billing'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('billing')->setAllowEmpty(true)->setMultiOptions(DomainsProfiles::getList(true)); $this->addElement('text', 'creation_date', array('filters' => array('StringTrim'), 'label' => $translate->_('Creation date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat())); $this->addElement('text', 'expiring_date', array('filters' => array('StringTrim'), 'label' => $translate->_('Expiry Date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat())); $this->addElement('text', 'authinfocode', array('filters' => array('StringTrim'), 'label' => $translate->_('AUTHINFO CODE'), 'description' => $translate->_('Write down the Authinfo code in order to transfer the domain to this ISP'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->addElement('checkbox', 'autorenew', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Auto renewal'), 'class' => 'form-control')); $this->addElement('select', 'customer_id', array('label' => $translate->_('Customer'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('customer_id')->setAllowEmpty(false)->setMultiOptions(Customers::getList())->setRequired(true); // $note = $this->addElement('textarea', 'note', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Private Notes'), 'class' => 'col-lg-12 form-control')); $note = $this->addElement('textarea', 'message', array('filters' => array('StringTrim'), 'required' => false, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Message'), 'class' => 'col-lg-12 form-control wysiwyg')); $status = $this->addElement('select', 'status_id', array('label' => 'Status', 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control')); // DNS SECTION // ============== $this->addElement('text', 'subdomain', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Subdomain'), 'class' => 'form-control')); $this->addElement('text', 'target', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Target'), 'class' => 'form-control')); $this->addElement('select', 'zone', array('label' => $translate->_('Zone'), 'decorators' => array('Bootstrap'), 'class' => 'form-control')); $this->getElement('zone')->setAllowEmpty(false)->setMultiOptions(Dns_Zones_Types::getZones()); $status = $this->getElement('status_id')->setAllowEmpty(false)->setMultiOptions(Statuses::getList('domains')); $save = $this->addElement('submit', 'save', array('required' => false, 'label' => $translate->_('Save'), 'decorators' => array('Bootstrap'), 'class' => 'btn')); $id = $this->addElement('hidden', 'domain_id'); }
/** * Update the record previously selected */ public function processAction() { $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector'); $form = $this->getForm("/admin/domainsprofiles/process"); $request = $this->getRequest(); // Create the buttons in the edit form $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/domainsprofiles/list", "label" => $this->translator->translate('List'), "params" => array('css' => null)), array("url" => "/admin/domainsprofiles/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null))); try { // Check if we have a POST request if (!$request->isPost()) { return $this->_helper->redirector('list', 'domainsprofiles', 'admin'); } if ($form->isValid($request->getPost())) { $params = $request->getPost(); $area = intval($params['area']); if ($area != 0) { $province = Provinces::find($area); $area = $province->code; $params['area'] = $area; } $id = DomainsProfiles::saveAll($params, $request->getParam('profile_id')); $this->_helper->redirector('edit', 'domainsprofiles', 'admin', array('id' => $id, 'mex' => $this->translator->translate('The task requested has been executed successfully.'), 'status' => 'success')); } else { $this->view->form = $form; $this->view->title = $this->translator->translate("Domain Profile details"); $this->view->description = $this->translator->translate("Here you can edit the domains profile details."); return $this->render('applicantform'); } } catch (Exception $e) { $this->_helper->redirector('edit', 'domainsprofiles', 'admin', array('id' => $id, 'mex' => $e->getMessage(), 'status' => 'danger')); } }
/** * Save all the data in the database * @param array $data * @param integer $id */ public static function saveAll(array $data, $id = null) { if (!empty($data) && is_array($data)) { if (is_numeric($id)) { $profile = Doctrine::getTable('DomainsProfiles')->find($id); if ($profile->profile_id != $id) { return false; } } else { $profile = new DomainsProfiles(); $profile['created_at'] = date('Y-m-d h:i:s'); } $profile['customer_id'] = $data['customer_id']; $profile['company'] = $data['company']; $profile['firstname'] = $data['firstname']; $profile['lastname'] = $data['lastname']; $profile['gender'] = $data['gender']; $profile['email'] = $data['email']; $profile['phone'] = $data['phone']; $profile['fax'] = $data['fax']; $profile['birthplace'] = $data['birthplace']; $profile['birthdate'] = Shineisp_Commons_Utilities::formatDateIn($data['birthdate']); $profile['birthdistrict'] = $data['birthdistrict']; $profile['birthcountry'] = $data['birthcountry']; $profile['birthnationality'] = $data['birthnationality']; $profile['address'] = $data['address']; $profile['zip'] = $data['zip']; $profile['city'] = $data['city']; $profile['area'] = $data['area']; $profile['country_id'] = !empty($data['country_id']) ? $data['country_id'] : null; $profile['vat'] = $data['vat']; $profile['taxpayernumber'] = $data['taxpayernumber']; $profile['status_id'] = $data['status_id']; $profile['legalform_id'] = $data['legalform_id']; $profile['type_id'] = $data['type_id']; $profile['legalform_id'] = $data['legalform_id']; $profile['type_id'] = !empty($data['type_id']) ? $data['type_id'] : Null; $profile['updated_at'] = date('Y-m-d h:i:s'); if ($profile->trySave()) { // get the customer ID $data['profile_id'] = empty($data['profile_id']) ? $profile['profile_id'] : $data['profile_id']; return $profile['profile_id']; } } return false; }
/** * Save the domain profile data * @return unknown_type */ public function saveprofileAction() { $request = $this->getRequest(); // Check if we have a POST request if (!$request->isPost()) { return $this->_helper->redirector('profile'); } $form = new Default_Form_DomainsProfilesForm(array('action' => '/domains/profilesave/', 'method' => 'post')); $this->view->title = $this->translator->translate("Domain Profile"); $this->view->description = $this->translator->translate("Here you can create or edit the domain profile."); $this->view->mex = $this->getRequest()->getParam('mex'); $this->view->mexstatus = $this->getRequest()->getParam('status'); $this->view->form = $form; if (!$form->isValid($request->getPost())) { return $this->_helper->viewRenderer('profile'); } // Get the values posted $params = $form->getValues(); // add the customer id reference $params['customer_id'] = $this->customer['customer_id']; $profileId = !empty($params['profile_id']) ? $params['profile_id'] : null; if (0 == DomainsNichandle::isUsed($profileId)) { $profileId = DomainsProfiles::saveAll($params, $profileId); } else { $this->_helper->redirector('profile', 'domains', 'default', array('id' => $profileId, 'mex' => 'You cannot edit the profile because it is connected to a domain.', 'status' => 'danger')); } $this->_helper->redirector('profile', 'domains', 'default', array('id' => $profileId, 'mex' => 'The task requested has been executed successfully.', 'status' => 'success')); $this->_helper->viewRenderer('profile'); }
/** * * @param integer $domainId * @param string $type */ private function createNic($domainId, $type = 'owner') { $soap = $this->Connect(); if (!empty($this->session)) { $tld = Domains::getDomainTld($domainId); // get the domain profile $profile = DomainsProfiles::getProfileByDomainId($domainId, $type); if ($profile) { // Set generic variables for parameters $profile['countrycode'] = strtolower(Countries::getCodebyId($profile['country_id'])); $profile['birthdate'] = Shineisp_Commons_Utilities::formatDateOut($profile['birthdate']); $profile['password'] = Shineisp_Commons_Utilities::GenerateRandomString(); $profile['fullname'] = $profile['firstname'] . " " . $profile['lastname']; $profile['legalform'] = strtolower($profile['Legalforms']['name']); $profile['corporationtype'] = strtolower($profile['CompanyTypes']['name']); $profile['legalnumber'] = null; $profile['language'] = "en"; $profile['isowner'] = $type == "owner" ? true : false; if ($tld == "it") { // Create a nicHandle for the Italian domain tld $params[] = $this->session['id']; // Session $params[] = $profile['lastname']; // Lastname $params[] = $profile['firstname']; // Firstname $params[] = $profile['gender']; // Gender $params[] = $profile['password']; // Password $params[] = $profile['email']; // Email $params[] = $profile['phone']; // Phone $params[] = $profile['fax']; // Fax $params[] = $profile['address']; // Address $params[] = $profile['city']; // City $params[] = $profile['area']; // Area $params[] = $profile['zip']; // Zip $params[] = $profile['countrycode']; // Country Code $params[] = $profile['language']; // Language $params[] = $profile['isowner']; // isOwner $params[] = $profile['legalform']; // Legalform $params[] = $profile['company']; // Organisation $params[] = $profile['fullname']; // Legal name $params[] = $profile['legalnumber']; // Legal Number $params[] = $profile['vat']; // VAT or IVA $params[] = $profile['birthdate']; // Birthday $params[] = $profile['birthplace']; // Birthcity $params[] = $profile['taxpayernumber']; // Contact fiscal code or company vat $params[] = $profile['vat']; // Company National Identification Number $params[] = $profile['corporationtype']; $nicHandle = call_user_func_array(array($soap, 'nicCreateIT'), $params); Shineisp_Commons_Utilities::log('Calling profile nicCreateIT with these params: ' . json_encode($params), "registrar.ovh.log"); } else { $params[] = $this->session['id']; // Session $params[] = $profile['lastname']; // Lastname $params[] = $profile['firstname']; // Firstname $params[] = $profile['password']; // Password $params[] = $profile['email']; // Email $params[] = $profile['phone']; // Phone $params[] = $profile['fax']; // Fax $params[] = $profile['address']; // Address $params[] = $profile['city']; // City $params[] = $profile['area']; // Area $params[] = $profile['zip']; // Zip $params[] = $profile['countrycode']; // Country Code $params[] = $profile['language']; // Language $params[] = $profile['isowner']; // isOwner $params[] = $profile['legalform']; // Legalform $params[] = $profile['company']; // Organisation $params[] = $profile['fullname']; // Legal name $params[] = $profile['legalnumber']; // Legal Number $params[] = $profile['vat']; // VAT or IVA $nicHandle = call_user_func_array(array($soap, 'nicCreate'), $params); Shineisp_Commons_Utilities::log('Calling profile nicCreate with these params: ' . json_encode($params), "registrar.ovh.log"); } if (!empty($nicHandle)) { CustomersDomainsRegistrars::addNicHandle($domainId, $nicHandle, $type, $profile['profile_id']); // Save the nic-Handle in the database } } else { // If the client has not create any profile, the main client information will be set in all domain tld field [admin, tech, owner, billing] // Get the domain information $domain = Domains::find($domainId); // Create the OVH nic-Handle $nicHandle = $this->createNicHandlebyCustomer($domain[0]['customer_id'], $domainId); // Save the nic-Handle in the database CustomersDomainsRegistrars::addNicHandle($domainId, $nicHandle); } return $nicHandle; } return false; }