예제 #1
0
 function load_widgets()
 {
     foreach ($this->fields as $field_name => $field) {
         $widget = new WidgetBuilder($field_name, $field);
         $this->widgets[$field_name] = $widget->get_widget();
         if ($field["fieldset"]) {
             $this->fieldsets[$field["fieldset"]]["fields"][] = $field_name;
         }
     }
 }
 function testRunPass()
 {
     // modify the request so we have a fake one
     $wb = new WidgetBuilder('helpers/widget_testcase_001');
     $filename = $wb->getFilename();
     $z = new ZipArchive();
     $z->open($filename);
     $fp = $z->getStream('widget.txt');
     $this->assertTrue($fp);
     while (!feof($fp)) {
         $contents .= fread($fp, 2);
     }
     fclose($fp);
     $this->assertEqual($contents, 'pass');
 }
예제 #3
0
 public function build($entityType, $bundleName)
 {
     if (!($info = field_info_instance($entityType, $this->field_name, $bundleName))) {
         field_create_instance(array('entity_type' => $entityType, 'bundle' => $bundleName, 'field_name' => $this->field_name, 'label' => $this->label, 'description' => $this->description, 'required' => $this->required, 'settings' => array(), 'widget' => $this->widget->getDefinition(), 'display' => array()));
     }
 }
예제 #4
0
		<!-- Begin Dashboard for Administrators -->

		<div class="row-fluid">
			<div class="span12">
				<h1 class="page-title">Dashboard - Admin</h1>
			</div>
		</div>
	
		<div class="row-fluid">
		
			<div class="span6">

			<?php 
$testwidget = new WidgetBuilder();
$testwidget->buildWidget();
?>

			</div>

			<div class="span6">

			<?php 
$tablewidget = new ApprovalWidget();
$tablewidget->widget_name = "Unapproved Variables";
$tablewidget->widget_item_type = "variable";
$tablewidget->buildWidget();
?>

			</div>
		</div>
$path = './';
$objects = new RecursiveIteratorIterator(
    new RecursiveDirectoryIterator(
        $path
    ), 
    RecursiveIteratorIterator::SELF_FIRST
);
foreach($objects as $name => $object){
    echo "$name <br>";
    //echo $object->getFilename().'<br>';
}
die();
*/
// Construct widget with all default settings
$widgetTC = 'foo/001';
$wb = new WidgetBuilder($widgetTC);
//die();
/*$f = $wb->getFilename();
echo $f."\n";
echo filesize($f)."<br><br>";
/**/
// ok zippingen virker. det some r problemet er at den starter
// helt med c: og tar med hele skiten! jeg må få den til å gi
// det interne navnet relativt til denne folderen.
// Stream the file to the client
$f = $wb->getFilename();
header("Content-Type: application/zip");
header("Content-Length: " . filesize($f));
header("Content-Disposition: attachment; filename=\"a_zip_file.zip\"");
readfile($f);
//unlink($file);