Advertisement
vishnu3006

Untitled

Oct 3rd, 2011
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.39 KB | None | 0 0
  1. //freeway.module
  2.  
  3. <?php
  4. // $Id$
  5.  
  6. /**
  7.   * @file
  8.   * Lets users utilize freeway
  9.   *
  10.   */
  11.  
  12. /**
  13. * Implementation of hook_menu().
  14. */
  15. function freeway_menu() {
  16. $items['admin/settings/freeway'] = array(
  17. 'title' => 'Freeway',
  18. 'description' => 'Freeway functionalities.',
  19. 'page callback' => 'drupal_get_form',
  20. 'page arguments' => array('freeway_admin_settings'),
  21. 'access arguments' => array('administer site configuration'),
  22. 'type' => MENU_NORMAL_ITEM,
  23. 'file' => 'freeway.admin.inc',
  24. );
  25.  
  26. $items['admin/content/node-type/'. $type_url_str .'/sendfortranslation'] = array(
  27. 'title' => 'Send For Translation',
  28. 'type' => MENU_DEFAULT_LOCAL_TASK,
  29.     );
  30.  
  31.  $items['node/%node/sendfortranslation'] = array(
  32.     'title' => 'Send For Translation',
  33.     'page callback' => 'send_for_translation',
  34.     'page arguments' => array(1),
  35.     'access callback' => 'node_access',
  36.     'access arguments' => array('update', 1),
  37.     'weight' => 1,
  38.     'file' => 'freeway.admin.inc',
  39.     'type' => MENU_LOCAL_TASK,
  40.   );
  41.    
  42. return $items;
  43. }
  44.  
  45.  
  46. //freeway.admin.inc
  47. <?php
  48.  
  49. function freeway_admin_settings() {
  50.   $options = node_get_types('names');
  51.   $form['freeway_node_types'] = array(
  52.  '#type' => 'checkboxes',
  53.  '#title' => t('Contents which can be considered for Freeway'),
  54.  '#options' => $options,
  55.  '#default_value' => variable_get('freeway_node_types', array('page')),
  56.  '#description' => t('A text field will be available on these content types to make user-specific notes.'),
  57.  
  58.  
  59. );
  60. return system_settings_form($form);
  61. }
  62.  
  63.  
  64. function send_for_translation($node) {
  65.  
  66.  $nodes_id = $node->nid;
  67.   $contents = freeway_dashboard_build_filter_query($nodes_id);
  68.  
  69.   while ($latest_node = db_fetch_object($contents)) {
  70.    
  71.      $body = $latest_node->body ;
  72.      $LoginClient = new SoapClient("wsdlLink ", array("trace"=>1));
  73.      $AddFile = new SoapClient("wsdlLink", array("trace"=>1));
  74.    
  75.   $arrayLan = array('fr-fr');
  76.  
  77.             try
  78.             {
  79.            
  80.                 $arrResponse = $LoginClient->Logon(array ('Username'=>'Username','Password'=>'password'));
  81.                 $ticket = ($arrResponse->LogonResult);
  82.                 print_r($ticket);
  83.                
  84.                
  85.                 //$myCalendar = new tc_calendar("date1", true);
  86.                 //$myCalendar->setDate(1, 1, 2000);
  87.                
  88.                                        
  89.             //$addProj = $AddFile->CreateProject(array('Ticket'=>$ticket,'Description'=>'Abcd','SpecialInstructions'=>'splinst','CustomReference'=>'custRef','POReference'=>'PoRef','ExpectedStartingDate'=>$d,'ExpectedDeliveryDate'=>$d,'MetaData'=>null));
  90.                
  91.                
  92.                 $fileName = "vibgyor.txt";             
  93.                 $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'));
  94.                
  95.                 $addFile = $AddFile->AddFileToProject(array('Ticket'=>$ticket,'ProjectID'=>'436170','Filename'=>$fileName,'FileData'=> $body, 'SourceLanguageID'=> 'en-us', 'TargetLanguageIDs'=> $arrayLan,'Metadata'=> null,'IsReferenceMaterial'=>false));
  96.                
  97.  
  98.             }
  99.            
  100.             catch(SoapFault $exception)
  101.             {
  102.                echo ("Inside Exception");
  103.                echo $exception;
  104.             }
  105.    
  106.  }
  107.  
  108. }
  109.  
  110. function freeway_dashboard_build_filter_query($nodes_id) {
  111.  $nodes_id_inMethod = $nodes_id;
  112.  $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'" );
  113.  return $contents;
  114. }
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement