Example #1
0
    protected function getField($field)
    {
        $r = new stdClass();
        $r->field = $field;
        $searchRequest = $this->searchRequest->getSearchRequest();
        $form = Loader::helper('form');
        ob_start();
        switch ($field) {
            case 'size':
                ?>
				<?php 
                echo $form->text('size_from', $searchRequest['size_from'], array('style' => 'width:  60px'));
                ?>
				<?php 
                echo t('to');
                ?>
				<?php 
                echo $form->text('size_to', $searchRequest['size_to'], array('style' => 'width: 60px'));
                ?>
                <?php 
                echo t('KB');
                ?>
				<?php 
                break;
            case 'type':
                $t1 = FileType::getUsedTypeList();
                $types = array();
                foreach ($t1 as $value) {
                    $types[$value] = FileType::getGenericTypeText($value);
                }
                print $form->select('type', $types, $searchRequest['type'], array('style' => 'width: 120px'));
                break;
            case 'extension':
                $ext1 = FileType::getUsedExtensionList();
                $extensions = array();
                foreach ($ext1 as $value) {
                    $extensions[$value] = $value;
                }
                print $form->select('extension', $extensions, $searchRequest['extensions'], array('style' => 'width: 120px'));
                break;
            case 'date_added':
                ?>
				<?php 
                echo $form->text('date_from', $searchRequest['date_from'], array('style' => 'width: 86px'));
                ?>
				<?php 
                echo t('to');
                ?>
				<?php 
                echo $form->text('date_to', $searchRequest['date_to'], array('style' => 'width: 86px'));
                ?>
				<?php 
                break;
            case 'added_to':
                ?>
				<?php 
                $ps = Loader::helper("form/page_selector");
                print $ps->selectPage('ocIDSearchField');
                break;
            default:
                if (Loader::helper('validation/numbers')->integer($field)) {
                    $ak = FileAttributeKey::getByID($field);
                    $ak->render('search');
                }
                break;
        }
        $contents = ob_get_contents();
        ob_end_clean();
        $r->html = $contents;
        return $r;
    }