Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function create_freeway_project() {
- drupal_add_js(drupal_get_path('module', 'freeway') . '/js/dashboardscript.js');
- //date_popup_load();
- $node = node_load(arg(1));
- $form = array();
- $arrayForSendTranslation = array();
- $arrayForSendTranslation = credentialProvider();
- $finalFunctionUserName = $arrayForSendTranslation[0];
- $finalFunctionPassword = $arrayForSendTranslation[1];
- $parts = parse_ini_file('sites/all/modules/freeway/urlconfig.ini');
- $LoginClient = new SoapClient($parts['part1'], array("trace" => 1));
- $ServicesLink = new SoapClient($parts['part2'], array("trace" => 1));
- try {
- $arrResponse = $LoginClient->Logon(array('Username' => $finalFunctionUserName, 'Password' => $finalFunctionPassword));
- $ticket = ($arrResponse->LogonResult);
- $custAnalysis = $ServicesLink->GetCustomerAnalysisCodes(array('Ticket' => $ticket, 'AnalysisCodeLabel' => ''));
- $analysisNames = array();
- $analysisCodeOne = array();
- $analysisCodeTwo = array();
- foreach ($custAnalysis->GetCustomerAnalysisCodesResult->AnalysisCodeGroup as $acode) {
- $analysisNames[] = $acode->Name;
- }
- for ($i = 0; $i < count($analysisNames) -1; $i += 1) {
- $custAnalysisInner = $ServicesLink->GetCustomerAnalysisCodes(array('Ticket' => $ticket, 'AnalysisCodeLabel' => $analysisNames[$i]));
- foreach ($custAnalysisInner->GetCustomerAnalysisCodesResult->AnalysisCodeGroup->AnalysisCodes->AnalysisCode as $acodes) {
- if ($i == 0) {
- $codeOne = $acodes->Name;
- $analysisCodeOne[] = $codeOne;
- }
- if ($i == 1) {
- $codeTwo = $acodes->Name;
- $analysisCodeTwo[] = substr($codeTwo, 1 );
- }
- }
- }
- }
- catch (SoapFault $exception) {
- drupal_get_messages();
- drupal_set_message("The following exception took place." . $exception . "Kindly check Freeway mapping");
- drupal_goto("user");
- }
- $defaultRef = 'My Reference';
- $form['title'] = array(
- '#type' => 'textfield',
- '#title' => t('Project Description'),
- '#size' => 60,
- '#maxlength' => 30,
- '#required' => TRUE,
- );
- $form['custRef'] = array(
- '#type' => 'textfield',
- '#title' => t('Customer Reference'),
- '#default_value' => $defaultRef,
- '#size' => 60,
- '#maxlength' => 30,
- '#required' => FALSE,
- );
- $form['poRef'] = array(
- '#type' => 'textfield',
- '#title' => t('PO Reference'),
- '#size' => 60,
- '#maxlength' => 30,
- '#required' => FALSE,
- );
- $form['splinst'] = array(
- '#type' => 'textarea',
- '#title' => t('Special Instructions'),
- '#size' => 60,
- '#maxlength' => 100,
- '#required' => FALSE,
- );
- /*
- $form['enddate'] = array(
- '#type' => 'date_popup',
- '#title' => t('Delivery Date'),
- '#size' => 60,
- '#maxlength' => 128,
- '#required' => TRUE,
- '#date_format' => 'm/d/Y'
- // With this format you'll get a date popup box AND a time widget. Obviously you can change this to whatever you need.
- );
- */
- $form['enddate'] = array(
- '#type' => 'date_select',
- '#title' => t('Delivery Date:'),
- '#date_format' => 'd-m-Y',
- '#default_value' => $enddate,
- '#date_year_range' => '0:+10',
- '#required' => TRUE,
- '#date_label_position' => 'within'
- );
- $form['create_project_btn'] = array(
- '#type' => 'submit',
- '#value' => 'Create Freeway Project',
- '#weight' => 10,
- );
- return $form;
- }
Advertisement
Add Comment
Please, Sign In to add comment