public function execute(HTTPRequestCustom $request)
 {
     $this->load_lang();
     $this->load_config();
     $theme = $request->get_value('theme', 'all');
     if ($theme !== 'all' && !ThemesManager::get_theme_existed($theme)) {
         AppContext::get_response()->redirect(AdminCustomizeUrlBuilder::customize_interface());
     }
     $this->build_form($theme);
     $tpl = new StringTemplate('# INCLUDE MSG # # INCLUDE FORM #');
     $tpl->add_lang($this->lang);
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $header_logo = $this->form->get_value('header_logo', null);
         if ($header_logo !== null) {
             $file_type = new FileType(new File($header_logo->get_name()));
             if ($file_type->is_picture()) {
                 $this->save($header_logo, $theme);
                 AppContext::get_response()->redirect(AdminCustomizeUrlBuilder::customize_interface());
             } else {
                 $tpl->put('MSG', MessageHelper::display(LangLoader::get_message('process.error', 'status-messages-common'), MessageHelper::ERROR, 4));
             }
         } elseif ($this->form->get_value('use_default_logo')) {
             $this->delete_pictures_saved($theme);
             AppContext::get_response()->redirect(AdminCustomizeUrlBuilder::customize_interface());
         } else {
             $tpl->put('MSG', MessageHelper::display(LangLoader::get_message('process.error', 'status-messages-common'), MessageHelper::ERROR, 4));
         }
     }
     $tpl->put('FORM', $this->form->display());
     return new AdminCustomizationDisplayResponse($tpl, $this->lang['customization.interface']);
 }
 /**
  * @return string The html code for the input.
  */
 public function display()
 {
     $template = $this->get_template_to_use();
     $this->assign_common_template_variables($template);
     $file_type = new FileType(new File($this->get_value()));
     $template->put_all(array('C_PREVIEW_HIDDEN' => !$file_type->is_picture(), 'C_AUTH_UPLOAD' => FileUploadConfig::load()->is_authorized_to_access_interface_files(), 'FILE_PATH' => Url::to_rel($this->get_value())));
     return $template;
 }
Beispiel #3
0
 public function __construct($filename)
 {
     // 4 - uint32_t version
     // 4 - uint32_t soldiercount
     // 32 - char name[32]
     parent::__construct($filename, 40, "V1version/V1soldiercount/a32name");
 }
Beispiel #4
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validation = Validator::make($input = Input::all(), Blink::$rules);
     if ($validation->passes()) {
         $imgFld = Blink::GenerateFolder();
         $mime = Input::file('item')->getMimeType();
         $extension = Input::file('item')->getClientOriginalExtension();
         $fileType = FileType::whereRaw("LOWER(mimetype)='" . strtolower($mime) . "'")->firstOrFail();
         $input["file_type_id"] = $fileType->id;
         $tempF = tempnam($imgFld, '');
         $tempF = str_replace(".tmp", "", basename($tempF));
         Input::file('item')->move($imgFld, $tempF . "." . $extension);
         $input["file_location"] = $imgFld . $tempF . "." . $extension;
         $input["upload_ip"] = Request::getClientIp();
         $c = 0;
         $token = Blink::getToken(10);
         $uniqueC = Blink::where("url_token", "=", $token)->whereNull("expired_at")->count();
         while ($uniqueC > 0 && $c < 20) {
             $c++;
             $token = Blink::getToken(10);
             $uniqueC = Blink::where("url_token", "=", $token)->whereNull("expired_at")->whereNull("deleted_at")->count();
         }
         $input["url_token"] = $token;
         $blink = Blink::create($input);
         $base = SysVariable::Get(SysVariable::$shorten_url);
         echo $base . $blink->url_token;
         //return Redirect::route('blinks.index');
     }
     /*return Redirect::route('blinks.create')
     		->withInput()
     		->withErrors($validation)
     		->with('message', 'There were validation errors.');*/
 }
Beispiel #5
0
 public static function getListTypes()
 {
     $models = FileType::model()->findAll();
     $list = array();
     foreach ($models as $key => $model) {
         $list[$model->id] = $model->name;
     }
     return $list;
 }
Beispiel #6
0
 public function __construct($filename)
 {
     #  4 - uint32_t version
     #  4 - uint32_t compressed
     #  4 - uint32_t subsystems
     # 52 - uint32_t dummy[13]
     # 16 - char gameVersion[16]
     # 32 - char name[32]
     # 32 - char gameDate[32]
     # 32 - char realDate[32]
     parent::__construct($filename, 176, "V1version/V1compressed/V1subsystems/V13dummy/a16gameversion/a32name/a32gamedate/a32realdate");
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->load_lang();
     $this->load_config();
     $this->build_form();
     $tpl = new StringTemplate('# INCLUDE MSG # # INCLUDE FORM #');
     $tpl->add_lang($this->lang);
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $favicon = $this->form->get_value('favicon', null);
         if ($favicon !== null) {
             $file_type = new FileType(new File($favicon->get_name()));
             if ($file_type->is_picture()) {
                 $this->save($favicon);
                 $tpl->put('MSG', MessageHelper::display(LangLoader::get_message('process.success', 'status-messages-common'), MessageHelper::SUCCESS, 4));
             } else {
                 $tpl->put('MSG', MessageHelper::display(LangLoader::get_message('process.error', 'status-messages-common'), MessageHelper::ERROR, 4));
             }
         } else {
             $tpl->put('MSG', MessageHelper::display($this->lang['customization.favicon.error'], MessageHelper::ERROR, 4));
         }
     }
     $tpl->put('FORM', $this->form->display());
     return new AdminCustomizationDisplayResponse($tpl, $this->lang['customization.interface']);
 }
Beispiel #8
0
 /**
  * Dynamically return file url from release, format and show.
  *
  * @return string
  */
 public function get_file_url()
 {
     $podcast = Podcast::get_instance();
     $episode = $this->episode();
     $episode_asset = EpisodeAsset::find_by_id($this->episode_asset_id);
     $file_type = FileType::find_by_id($episode_asset->file_type_id);
     if (!$episode_asset || !$file_type || !$episode->slug) {
         return '';
     }
     $template = $episode_asset->url_template;
     $template = str_replace('%media_file_base_url%', $podcast->media_file_base_uri, $template);
     $template = str_replace('%episode_slug%', $episode->slug, $template);
     $template = str_replace('%format_extension%', $file_type->extension, $template);
     return $template;
 }
	<form method="get" class="form-horizontal" id="ccm-<?php 
echo $searchInstance;
?>
-advanced-search" action="<?php 
echo REL_DIR_FILES_TOOLS_REQUIRED;
?>
/files/search_results">
	<?php 
if ($_REQUEST['fType'] != false) {
    $showTypes = array();
    if (is_array($_REQUEST['fType'])) {
        foreach ($_REQUEST['fType'] as $showTypeId) {
            $showTypes[] = FileType::getGenericTypeText($showTypeId);
        }
    } else {
        $showTypes[] = FileType::getGenericTypeText($_REQUEST['fType']);
    }
    ?>
		<div class="ccm-file-manager-pre-filter"><?php 
    echo t('Only displaying %s files.', implode(', ', $showTypes));
    ?>
</div>
	<?php 
} else {
    if ($_REQUEST['fExtension'] != false) {
        if (is_array($_REQUEST['fExtension'])) {
            $showExtensions = $_REQUEST['fExtension'];
        } else {
            $showExtensions = array($_REQUEST['fExtension']);
        }
        ?>
Beispiel #10
0
 public function getFileType()
 {
     return FileType::find($this->filetype)->name;
 }
Beispiel #11
0
	public function getGenericTypeText($type) {
		if ($type > 0) {
			return FileType::mapGenericTypeText($type);
		} else if (!empty($this->type)) {
			return FileType::mapGenericTypeText($this->type);		
		}
	}
 public function actionGeneratePdf()
 {
     $this->layout = 'pdf';
     $model = new FileType('search');
     if (isset($_GET['FileType'])) {
         $model->attributes = $_GET['FileType'];
     }
     // to execute the filters (if is the case)
     $dataProvider = $model->search();
     $dataProvider->pagination = false;
     $mPDF1 = Yii::app()->ePdf->mpdf();
     # You can easily override default constructor's params
     $mPDF1 = Yii::app()->ePdf->mpdf('', 'A5');
     # renderPartial (only 'view' of current controller)
     $mPDF1->WriteHTML($this->renderPartial('admin', array('model' => $model), true));
     # Outputs ready PDF
     $mPDF1->Output();
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = FileType::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Beispiel #14
0
                <?
                foreach ($files->getData() as $file) {
                    ?>
                    <tr>
                        <?
                        echo $form->hiddenField($file, '[' . $i . ']extension');
                        echo $form->hiddenField($file, '[' . $i . ']id');
                        echo $form->hiddenField($file, '[' . $i . ']dataset_id');
                        echo $form->hiddenField($file, '[' . $i . ']location');
                        echo $form->hiddenField($file, '[' . $i . ']extension');
                        ?>

                        <td class="left"><?php echo $file->name ?></td>
                        <td class="left"><?= CHtml::activeDropDownList($file, '[' . $i . ']code', $samples_data, array('class' => 'span2')); ?></td>

                        <td class="left"><?= CHtml::activeDropDownList($file, '[' . $i . ']type_id', CHtml::listData(FileType::model()->findAll(), 'id', 'name'), array('class' => 'span2')); ?></td>

                        <td> <?= CHtml::activeDropDownList($file, '[' . $i . ']format_id', CHtml::listData(FileFormat::model()->findAll(), 'id', 'name'), array('class' => 'autowidth')); ?></td>
                        <td><span style="display:none"><?= File::staticGetSizeType($file->size) . ' ' . strlen($file->size) . ' ' . $file->size ?></span><?= MyHtml::encode(File::staticBytesToSize($file->size)) ?></td>

                        <td><?php echo $form->textArea($file, '[' . $i . ']description', array('rows' => 3, 'cols' => 30, 'style' => 'resize:none')); ?></td>

                        <td> <?php echo CHtml::submitButton("Update", array('class' => 'update btn', 'name' => $i)); ?> </td>
                    </tr>

                    <?
                    $i++;
                }
                ?>

            </table>
 public function updateFile($f, $data)
 {
     $f->name = $data[0];
     $f->code = $data[1];
     $type = $f->type;
     $format = $f->format;
     if ($data[2] != $type->name) {
         $nt = FileType::model()->find(array('condition' => 'lower(name) = :name', 'params' => array(':name' => strtolower($data[2]))));
         if ($nt) {
             $f->type_id = $nt->id;
         } else {
             $nt = FileType::model()->findByAttributes(array('name' => 'Other'));
             if (!$nt) {
                 $nt = new FileType();
                 $nt->name = 'Other';
                 $nt->save();
             }
             $f->type_id = $nt->id;
         }
     }
     if ($data[3] != $format->name) {
         $nf = FileFormat::model()->find(array('condition' => 'lower(name) =:name', 'params' => array(':name' => strtolower($data[3]))));
         if ($nf) {
             $f->format_id = $nf->id;
         } else {
             $nf = FileFormat::model()->findByAttributes(array('name' => 'UNKNOWN'));
             if (!$nf) {
                 $nf->name = 'UNKNOWN';
                 $nf->save();
             }
             $f->format_id = $nf->id;
         }
     }
     $f->description = $data[4];
     if (!$f->save()) {
         Yii::log(print_r($f->getErrors(), true), 'debug');
     }
     return;
 }
Beispiel #16
0
?>

<?php 
$this->widget('application.extensions.print.printWidget', array('cssFile' => 'print.css', 'printedElement' => '#view', 'htmlOptions' => array('style' => 'padding:20px')));
?>
<div id="view">

    <?php 
$labelRow = Label::model()->findByPk(6);
$attributes = str_replace(' ', '_', strtoupper($labelRow['fields']));
$itemId = $_GET['itemId'];
$connection = Yii::app()->db;
$sql = "\n\t\tselect {$attributes}\n\t\tfrom fopen \n\t\twhere ID ={$itemId}";
$command = $connection->createCommand($sql);
$dataReader = $command->queryAll();
$filetypeRow = FileType::model()->findByAttributes(array('name' => $_GET['fileType']));
$w = (int) $filetypeRow['label_width'];
$h = (int) $filetypeRow['label_height'];
?>
    
	<table class="table table-bordered" style='width:<?php 
echo $w . "px";
?>
;height:<?php 
echo $h . "px";
?>
'>
		<tr>
		<?php 
foreach ($dataReader[0] as $key => $value) {
    echo "<th>{$key}</th>";
 public static function get_types()
 {
     global $wpdb;
     return $wpdb->get_col("SELECT DISTINCT `type` FROM " . FileType::table_name());
 }
Beispiel #18
0
 /**
  * Find the related media format model.
  *
  * @return \Podlove\Model\FileType|NULL
  */
 public function file_type()
 {
     return FileType::find_by_id($this->file_type_id);
 }
 /**
  * Fetch all valid feeds.
  * 
  * A feed is valid if...
  * 
  * - it has an asset assigned (and the asset has a filetype assigned)
  * - the slug in not empty
  * 
  * @return array list of feeds
  */
 public function feeds()
 {
     return $this->with_blog_scope(function () {
         $sql = "\n\t\t\t\tSELECT\n\t\t\t\t\tf.*\n\t\t\t\tFROM\n\t\t\t\t\t" . Feed::table_name() . " f\n\t\t\t\t\tJOIN " . EpisodeAsset::table_name() . " a ON a.id = f.episode_asset_id\n\t\t\t\t\tJOIN " . FileType::table_name() . " ft ON ft.id = a.file_type_id\n\t\t\t\tWHERE\n\t\t\t\t\tf.slug IS NOT NULL\n\t\t\t\tORDER BY \n\t\t\t\t\tposition ASC\n\t\t\t";
         return Feed::find_all_by_sql($sql);
     });
 }
Beispiel #20
0
<?php

namespace Podlove\Model;

class FileType extends Base
{
    public function title()
    {
        return $this->name . ' (' . $this->extension . ')';
    }
}
FileType::property('id', 'INT NOT NULL AUTO_INCREMENT PRIMARY KEY');
FileType::property('name', 'VARCHAR(255)');
FileType::property('type', 'VARCHAR(255)');
FileType::property('mime_type', 'VARCHAR(255)');
FileType::property('extension', 'VARCHAR(255)');
                    <div class="span3"><?php 
echo $form->dropDownList($model, 'paper', CHtml::listData(PaperType::model()->findAll(), 'id', 'name'));
?>
</div>    
                </div>
            </div>
        </tr>
        <tr>
            <div class="row">
                <div class="col-md-3 col-sm-6">
                    <div class="span2"><?php 
echo $form->labelEx($model, 'fileType', array('class' => 'inline-labels'));
?>
</div>
                    <div class="span3"><?php 
echo $form->dropDownList($model, 'fileType', CHtml::listData(FileType::model()->findAll(), 'id', 'name'), array('prompt' => '---', 'ajax' => array('type' => 'POST', 'id' => 'drop_selection', 'url' => CController::createUrl('dynamicrows2'), 'update' => '#details', 'data' => array('selection' => 'js:this.value'))));
?>
</div>  
                    <div class="span2" id="details"><span class="label label-info"> Default : Label Size:100px X 50px</span></div>
                </div>
            </div>
        </tr>
        <tr>
            <div class="row">
                <div class="col-md-3 col-sm-6">
                    <div class="span2"><?php 
echo $form->labelEx($model, 'depts', array('class' => 'inline-labels'));
?>
</div>
                    <div class="span3"><?php 
echo $form->dropDownList($model, 'depts', CHtml::listData(Dept::model()->findAllByAttributes(array('orgid' => Yii::app()->user->getState("org_id"))), 'id', 'name'), array('prompt' => '--- Select Department ---', 'ajax' => array('type' => 'POST', 'id' => 'drop_selection', 'url' => CController::createUrl('dynamicrows'), 'update' => '#Label_fileNames', 'data' => array('selection' => 'js:this.value'))));
?>
		
	</div>

	<form method="get" class="form-horizontal" id="ccm-<?php 
echo $searchInstance;
?>
-advanced-search" action="<?php 
echo REL_DIR_FILES_TOOLS_REQUIRED;
?>
/files/search_results">
	<?php 
if ($_REQUEST['fType'] != false) {
    ?>
		<div class="ccm-file-manager-pre-filter"><?php 
    echo t('Only displaying %s files.', FileType::getGenericTypeText($_REQUEST['fType']));
    ?>
</div>
	<?php 
} else {
    if ($_REQUEST['fExtension'] != false) {
        ?>
		<div class="ccm-file-manager-pre-filter"><?php 
        echo t('Only displaying files with extension .%s.', $_REQUEST['fExtension']);
        ?>
</div>
	<?php 
    }
}
?>
Beispiel #23
0
 private function getFileType($type)
 {
     $file_type = FileType::model()->find("name=?", array($type));
     if ($file_type == null) {
         $file_type = new FileType();
         $file_type->name = $type;
         $file_type->description = " ";
         $file_type->save(false);
     }
     return $file_type->id;
 }
/* @var $this LabelController */
/* @var $data Label */
?>

<?php 
$this->widget('application.extensions.print.printWidget', array('cssFile' => 'print.css', 'printedElement' => '#view', 'htmlOptions' => array('style' => 'padding:20px')));
?>

<div id="view">

    <?php 
$paper = PaperType::model()->findByAttributes(array('id' => $labelParams['paper']));
$paperWidth = $paper['width'];
if (trim($labelParams['fileType']) != '') {
    $fileType = $labelParams['fileType'];
    $filetypeRow = FileType::model()->findByAttributes(array('id' => $fileType));
} else {
    $filetypeRow['label_width'] = 400;
    $filetypeRow['label_height'] = 100;
}
$label_width = (int) $filetypeRow['label_width'] . 'px';
$label_height = (int) $filetypeRow['label_height'] . 'px';
$paper = $labelParams['paper'];
$numColumns = floor($paperWidth / $filetypeRow['label_width']);
$connection = Yii::app()->db;
if (trim($labelParams['depts']) == '') {
    $sql = "select CODE,TITLE from fopen";
} else {
    $deptRow = Dept::model()->find('id=:id', array(':id' => $labelParams['depts']));
    $deptName = $deptRow['name'];
    /* Which all Files??*/
	
<div id="ccm-<?php echo $searchInstance?>-search-advanced-fields" class="ccm-search-advanced-fields" >
	
		<input type="hidden" name="submit_search" value="1" />
	<?php 	/** 
		 * Here are all the things that could be passed through the asset library that we need to account for, as hidden form fields
		 */
		print $form->hidden('fType'); 
		print $form->hidden('fExtension'); 
		print $form->hidden('ccm_order_dir', $searchRequest['ccm_order_dir']); 
		print $form->hidden('ccm_order_by', $searchRequest['ccm_order_by']); 
		print $form->hidden('fileSelector', $fileSelector); 
	?>	
		<div id="ccm-search-box-title">
			<?php  if ($_REQUEST['fType'] != false) { ?>
				<div class="ccm-file-manager-pre-filter"><?php echo t('Only displaying %s files.', FileType::getGenericTypeText($_REQUEST['fType']))?></div>
			<?php  } else if ($_REQUEST['fExtension'] != false) { ?>
				<div class="ccm-file-manager-pre-filter"><?php echo t('Only displaying files with extension .%s.', $_REQUEST['fExtension'])?></div>
			<?php  } ?>
	
			<img src="<?php echo ASSETS_URL_IMAGES?>/throbber_white_16.gif" width="16" height="16" class="ccm-search-loading" id="ccm-<?php echo $searchInstance?>-search-loading" />
			
			<h2><?php echo t('Search')?></h2>			
		</div>
		
		<div id="ccm-search-advanced-fields-inner">
			<div class="ccm-search-field">
				<table border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td width="100%">
					<?php echo $form->text('fKeywords', $searchRequest['fKeywords'], array('style' => 'width:200px')); ?>
Beispiel #26
0
 public function __construct($filename)
 {
     parent::__construct($filename, 0, "");
 }
Beispiel #27
0
	        	<?php 
echo CHtml::activeDropDownList($model, 'format_id', CHtml::listData(FileFormat::model()->findAll(), 'id', 'name'));
?>
				<?php 
echo $form->error($model, 'format_id');
?>
			</div>
		</div>

		<div class="control-group">
			<?php 
echo $form->labelEx($model, 'type_id', array('class' => 'control-label'));
?>
			<div class="controls">
	        	<?php 
echo CHtml::activeDropDownList($model, 'type_id', CHtml::listData(FileType::model()->findAll(), 'id', 'name'));
?>
				<?php 
echo $form->error($model, 'type_id');
?>
			</div>
		</div>

		<div class="control-group">
			<?php 
echo $form->labelEx($model, 'sample_name', array('class' => 'control-label'));
?>
			<div class="controls">
	        			<?php 
echo CHtml::activeDropDownList($model, 'sample_name', CHtml::listData(Sample::model()->findAll(), 'id', 'name'), array('empty' => 'None'));
?>
 /**
  * Find the related media format model.
  *
  * @return \Podlove\Model\FileType|NULL
  */
 public function file_type()
 {
     return $this->with_blog_scope(function () {
         return FileType::find_by_id($this->file_type_id);
     });
 }
Beispiel #29
0
 public static function getTypeList($ids)
 {
     $crit = new CDbCriteria();
     $crit->join = "join file on file.type_id = t.id";
     $crit->addInCondition("file.id", $ids);
     return FileType::model()->findAll($crit);
 }