Exemplo n.º 1
0
 static function dropdown($content_r, $query_r = '', $trunc = '', $fields = 2)
 {
     $field_name = '';
     $get_name = true;
     $content = '';
     $query_r = DevArray::toArray($query_r);
     $output = '';
     $select_r = array();
     $select_r['-------'] = '';
     foreach ($content_r as $row) {
         $row = DevArray::toArray($row);
         $value_r = array();
         $i = 0;
         foreach ($row as $a => $b) {
             if ($get_name) {
                 $field_name = $a;
                 $get_name = DevBoolean::opposite($get_name);
             }
             if ($i > $fields) {
                 break;
             }
             // if ($i > 0) $value_r[] = HTML::format($b, '', $trunc);
             if ($i > 0) {
                 $value_r[] = HTML::format($b);
             }
             $i++;
         }
         $select_r[implode(' - ', $value_r)] = $row[$field_name];
     }
     foreach ($query_r as $a => $b) {
         $output .= Form::field('hidden', $a, '', $b);
     }
     $output .= Form::field('select', $field_name, '', $select_r) . Form::field('submit', 'submit', 'Submit', 'Submit');
     return $output;
 }
Exemplo n.º 2
0
 public function testObjectYieldsOppositeStatically()
 {
     $trueResult = DevBoolean::opposite(false);
     $this->assertTrue($trueResult);
     $falseResult = DevBoolean::opposite(true);
     $this->assertFalse($falseResult);
     $trueResult = DevBoolean::opposite(0);
     $this->assertTrue($trueResult);
     $falseResult = DevBoolean::opposite(1);
     $this->assertFalse($falseResult);
     $falseResult = DevBoolean::opposite('a');
     $this->assertFalse($falseResult);
     $falseResult = DevBoolean::opposite(-3);
     $this->assertFalse($falseResult);
 }