Esempio n. 1
0
 private function calculate()
 {
     $mand = 0;
     if (argv::string_abort()) {
         argv::remove("spring_L");
         argv::remove("spring_b");
         argv::remove("spring_t");
         argv::remove("spring_n");
         argv::remove("spring_n1");
         argv::remove("spring_F");
         argv::remove("spring_s");
         argv::remove("spring_type");
     }
     $L = argv::spring_L();
     $b = argv::spring_b();
     $t = argv::spring_t();
     $n = argv::spring_n();
     $n1 = argv::spring_n1();
     $F = argv::spring_F();
     $s = argv::spring_s();
     $type = argv::spring_type();
     $F = $F / 2;
     $L = $L / 2;
     $E = 200000;
     // set mandatory fields
     $this->content->leaf_length_class = "mand";
     $this->content->leaf_width_class = "mand";
     $this->content->leaf_thickness_class = "mand";
     $this->content->leaf_count_class = "mand";
     // calculation started
     if (argv::spring_calc()) {
         $this->content->action = "calculate";
         // check mandatory fields
         if (!$L) {
             $this->content->leaf_length_class = "mand_missing";
         } else {
             $mand++;
         }
         if (!$b) {
             $this->content->leaf_width_class = "mand_missing";
         } else {
             $mand++;
         }
         if (!$t) {
             $this->content->leaf_thickness_class = "mand_missing";
         } else {
             $mand++;
         }
         if (!$n) {
             $this->content->leaf_count_class = "mand_missing";
         } else {
             $mand++;
         }
     }
     // calculate leaf lenghs
     if ($L and $n) {
         $Lxg = 0;
         // add additional leafs
         if ($n1) {
             $Lxg = $n1 * $L;
         }
         for ($x = 0; $x < $n; $x++) {
             $Lx = 2 * $L * (1 - $x / $n);
             $Lxg += $Lx;
             $this->content->addChild("leaf_length_list", $Lx);
         }
         $this->content->addChild("leaf_length_overall", $Lxg);
     }
     // set result values
     $this->content->result = "---";
     $this->content->spring_result_class = "spring_result_error";
     // set result type
     if ($F) {
         $this->content->result_value = "s";
         $this->content->result_unit = "mm";
         $this->text("result_name", "bending");
         $this->content->spring_result_class = "spring_result";
     }
     if ($s) {
         $this->content->result_value = "F";
         $this->content->result_unit = "N";
         $this->text("result_name", "force");
         $this->content->spring_result_class = "spring_result";
     }
     // abbort if not mandatory
     if ($mand < 4) {
         return FALSE;
     }
     // PSI
     $psi = 3 / (2 + ($n1 + $type) / $n);
     //------------------------------------------------------------------------------
     // calculate bending
     if ($F) {
         // s denominator
         $_s = $E * $n * $b * pow($t, 3);
         // if s not NULL -> calculate
         if ($_s) {
             $s = $psi * 4 * $F * pow($L, 3) / $_s;
         }
         $this->content->result = number_format($s, 3);
     } elseif ($s) {
         // F denominator
         $_F = 4 * pow($L, 3) * $psi;
         // if F not NULL -> calculate
         if ($_F) {
             $F = $s * $E * $n * $b * pow($t, 3) / $_F;
         }
         $this->content->result = number_format($F, 3);
     }
     // sigma
     $this->content->spring_sigma = number_format(6 * $F * $L / ($n * $b * pow($t, 2)));
     //		echoall($this->content);
 }
Esempio n. 2
0
// login state
//   define USER for session
if (array_key_exists('user', $_SESSION)) {
    $user = $_SESSION['user'];
} else {
    $user = $_SESSION['user'] = "";
}
// change user login state
switch (argv::action()) {
    case 'login':
        if (OLIVUser::checkPassword(argv::login(), argv::password())) {
            $user = argv::login();
            // remove login parameters
            argv::remove('action');
            argv::remove('login');
            argv::remove('password');
        }
        break;
    case 'logout':
        $user = "";
        break;
    default:
        break;
}
// set user status
$_SESSION['user'] = $user;
status::set('OLIV_USER', $_SESSION['user']);
// set superuser state
if (OLIVUser::superUser(status::OLIV_USER())) {
    status::set('OLIV_SU', TRUE);
} else {
Esempio n. 3
0
 private function activities($header, $article)
 {
     // create index file
     switch (argv::action()) {
         case "create_index":
             $articleName = (string) $header->param->content;
             $index = new OLIVIndex();
             $textNodes = $article->XPath("//text");
             foreach ($textNodes as $text) {
                 $index->insertText((string) $text, "article:{$articleName}", (string) $text['lang']);
             }
             break;
         case "delete_index":
             argv::remove("action");
             break;
     }
 }