Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //freeway.module
- <?php
- // $Id$
- /**
- * @file
- * Lets users utilize freeway
- *
- */
- /**
- * Implementation of hook_menu().
- */
- function freeway_menu() {
- $items['admin/settings/freeway'] = array(
- 'title' => 'Freeway',
- 'description' => 'Freeway functionalities.',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('freeway_admin_settings'),
- 'access arguments' => array('administer site configuration'),
- 'type' => MENU_NORMAL_ITEM,
- 'file' => 'freeway.admin.inc',
- );
- $items['admin/content/node-type/'. $type_url_str .'/sendfortranslation'] = array(
- 'title' => 'Send For Translation',
- 'type' => MENU_DEFAULT_LOCAL_TASK,
- );
- $items['node/%node/sendfortranslation'] = array(
- 'title' => 'Send For Translation',
- 'page callback' => 'send_for_translation',
- 'page arguments' => array(1),
- 'access callback' => 'node_access',
- 'access arguments' => array('update', 1),
- 'weight' => 1,
- 'file' => 'freeway.admin.inc',
- 'type' => MENU_LOCAL_TASK,
- );
- return $items;
- }
- //freeway.admin.inc
- <?php
- function freeway_admin_settings() {
- $options = node_get_types('names');
- $form['freeway_node_types'] = array(
- '#type' => 'checkboxes',
- '#title' => t('Contents which can be considered for Freeway'),
- '#options' => $options,
- '#default_value' => variable_get('freeway_node_types', array('page')),
- '#description' => t('A text field will be available on these content types to make user-specific notes.'),
- );
- return system_settings_form($form);
- }
- function send_for_translation($node) {
- $nodes_id = $node->nid;
- $contents = freeway_dashboard_build_filter_query($nodes_id);
- while ($latest_node = db_fetch_object($contents)) {
- $body = $latest_node->body ;
- $LoginClient = new SoapClient("wsdlLink ", array("trace"=>1));
- $AddFile = new SoapClient("wsdlLink", array("trace"=>1));
- $arrayLan = array('fr-fr');
- try
- {
- $arrResponse = $LoginClient->Logon(array ('Username'=>'Username','Password'=>'password'));
- $ticket = ($arrResponse->LogonResult);
- print_r($ticket);
- //$myCalendar = new tc_calendar("date1", true);
- //$myCalendar->setDate(1, 1, 2000);
- //$addProj = $AddFile->CreateProject(array('Ticket'=>$ticket,'Description'=>'Abcd','SpecialInstructions'=>'splinst','CustomReference'=>'custRef','POReference'=>'PoRef','ExpectedStartingDate'=>$d,'ExpectedDeliveryDate'=>$d,'MetaData'=>null));
- $fileName = "vibgyor.txt";
- $addTask = $AddFile->AddTaskToProject(array('Ticket'=>$ticket,'ProjectID'=>'436170','SourceLanguageID'=> 'en-us', 'TargetLanguageID'=> 'fr-fr','ComponentID'=> 'Web','SubjectID'=>'std','TaskID'=>'LP','SubTaskID'=>'New Words','Volume'=>'50','UOMID'=>'Word'));
- $addFile = $AddFile->AddFileToProject(array('Ticket'=>$ticket,'ProjectID'=>'436170','Filename'=>$fileName,'FileData'=> $body, 'SourceLanguageID'=> 'en-us', 'TargetLanguageIDs'=> $arrayLan,'Metadata'=> null,'IsReferenceMaterial'=>false));
- }
- catch(SoapFault $exception)
- {
- echo ("Inside Exception");
- echo $exception;
- }
- }
- }
- function freeway_dashboard_build_filter_query($nodes_id) {
- $nodes_id_inMethod = $nodes_id;
- $contents = db_query("SELECT n.*, nr.body FROM node n JOIN node_revisions nr on n.vid = nr.vid where n.nid = '$nodes_id_inMethod'" );
- return $contents;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement