Example #1
0
 /**
  * @brief Display the loaded menu and plugins.
  */
 function Output()
 {
     $nomosagent_pk = GetParm("napk", PARM_INTEGER);
     $rf_shortname = GetParm("lic", PARM_RAW);
     $uploadtree_pk = GetParm("item", PARM_INTEGER);
     $uploadtree_tablename = GetParm("ut", PARM_RAW);
     $files = Level1WithLicense($nomosagent_pk, $rf_shortname, $uploadtree_pk, false, $uploadtree_tablename);
     $csv = count($files) != 0 ? rawurlencode($rf_shortname) . implode(',', array_keys($files)) : '';
     return $csv;
 }
 /**
  * \brief Display the loaded menu and plugins.
  */
 function Output()
 {
     global $Plugins;
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     //$uTime = microtime(true);
     // make sure there is a db connection
     switch ($this->OutputType) {
         case "XML":
             break;
         case "HTML":
             $nomosagent_pk = GetParm("napk", PARM_INTEGER);
             $rf_shortname = GetParm("lic", PARM_RAW);
             $uploadtree_pk = GetParm("item", PARM_INTEGER);
             $uploadtree_tablename = GetParm("ut", PARM_RAW);
             $debug = array_key_exists("debug", $_GET) ? true : false;
             $Files = Level1WithLicense($nomosagent_pk, $rf_shortname, $uploadtree_pk, false, $uploadtree_tablename);
             $V = "";
             if (count($Files) == 0) {
                 $V .= "";
             } else {
                 $V .= rawurlencode($rf_shortname);
                 foreach ($Files as $uppk => $fname) {
                     $V .= ",{$uppk}";
                 }
             }
             break;
         case "Text":
             break;
         default:
     }
     /*
      if ($debug)
     {
     $Time = microtime(true) - $uTime;  // convert usecs to secs
     $text = _("Elapsed time: %.2f seconds");
     printf( "<small>$text</small>", $Time);
     }
     */
     if (!$this->OutputToStdout) {
         return $V;
     }
     print "{$V}";
     return;
 }
 /**
  * \brief testing for Level1WithLicense
  */
 function testLevel1WithLicense()
 {
     print "test function Level1WithLicense()\n";
     global $PG_CONN;
     global $uploadtree_pk_parent;
     global $uploadtree_pk_child;
     global $pfile_pk_parent;
     global $pfile_pk_child;
     global $agent_pk;
     /** get a license short name */
     $sql = "SELECT rf_shortname from license_ref where rf_pk = 1;";
     $result = pg_query($PG_CONN, $sql);
     DBCheckResult($result, $sql, __FILE__, __LINE__);
     $row = pg_fetch_assoc($result);
     $rf_shortname = $row['rf_shortname'];
     pg_free_result($result);
     $file_name = Level1WithLicense($agent_pk, $rf_shortname, $uploadtree_pk_parent, false, $this->uploadtree_tablename);
     $this->assertEquals("license_test.file.child", $file_name[$uploadtree_pk_child]);
     print "unit test for common-license-file.php end\n";
 }