本文整理匯總了PHP中FabrikHelperHTML::mcl方法的典型用法代碼示例。如果您正苦於以下問題:PHP FabrikHelperHTML::mcl方法的具體用法?PHP FabrikHelperHTML::mcl怎麽用?PHP FabrikHelperHTML::mcl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FabrikHelperHTML
的用法示例。
在下文中一共展示了FabrikHelperHTML::mcl方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: mcl
/**
* Load the MCL canvas layer library
*
* @return array Scripts needed to load MCL
*/
public static function mcl()
{
// Cant used compressed version as its not up to date
$src = array('media/com_fabrik/js/lib/mcl/CANVAS.js', 'media/com_fabrik/js/lib/mcl/CanvasItem.js', 'media/com_fabrik/js/lib/mcl/Cmorph.js', 'media/com_fabrik/js/lib/mcl/Layer.js', 'media/com_fabrik/js/lib/mcl/LayerHash.js', 'media/com_fabrik/js/lib/mcl/Thread.js');
if (!self::$mcl) {
self::script($src);
self::$mcl = true;
}
return $src;
}
示例2: mcl
/**
* Load the MCL canvas layer library
*
* @return void
*/
public static function mcl()
{
if (!self::$mcl) {
$src = array('media/com_fabrik/js/lib/mcl/CANVAS.js', 'media/com_fabrik/js/lib/mcl/CanvasItem.js', 'media/com_fabrik/js/lib/mcl/Cmorph.js', 'media/com_fabrik/js/lib/mcl/Layer.js', 'media/com_fabrik/js/lib/mcl/LayerHash.js', 'media/com_fabrik/js/lib/mcl/Thread.js', 'media/com_fabrik/js/lib/canvas-extra.js');
self::script($src);
self::$mcl = true;
}
}
示例3: elementJavascript
/**
* Returns javascript which creates an instance of the class defined in formJavascriptClass()
*
* @param int $repeatCounter Repeat group counter
*
* @return array
*/
public function elementJavascript($repeatCounter)
{
$params = $this->getParams();
$id = $this->getHTMLId($repeatCounter);
FabrikHelperHTML::mcl();
$j3 = FabrikWorker::j3();
$element = $this->getElement();
$paramsKey = $this->getFullName(true, false);
$paramsKey = Fabrikstring::rtrimword($paramsKey, $this->getElement()->name);
$paramsKey .= 'params';
$formData = $this->getFormModel()->data;
$imgParams = FArrayHelper::getValue($formData, $paramsKey);
// Above paramsKey stuff looks really wonky - lets test if null and use something which seems to build the correct key
if (is_null($imgParams)) {
$paramsKey = $this->getFullName(true, false) . '___params';
$imgParams = FArrayHelper::getValue($formData, $paramsKey);
}
$value = $this->getValue(array(), $repeatCounter);
$value = is_array($value) ? $value : FabrikWorker::JSONtoData($value, true);
$value = $this->checkForSingleCropValue($value);
// Repeat_image_repeat_image___params
$rawValues = count($value) == 0 ? array() : array_fill(0, count($value), 0);
$fileData = $this->getFormModel()->data;
$rawKey = $this->getFullName(true, false) . '_raw';
$rawValues = FArrayHelper::getValue($fileData, $rawKey, $rawValues);
if (!is_array($rawValues)) {
$rawValues = explode(GROUPSPLITTER, $rawValues);
} else {
/*
* $$$ hugh - nasty hack for now, if repeat group with simple
* uploads, all raw values are in an array in $rawValues[0]
*/
if (is_array(FArrayHelper::getValue($rawValues, 0))) {
$rawValues = $rawValues[0];
}
}
if (!is_array($imgParams)) {
$imgParams = explode(GROUPSPLITTER, $imgParams);
}
$oFiles = new stdClass();
$iCounter = 0;
// Failed validation for ajax upload elements
if (is_array($value) && array_key_exists('id', $value)) {
$imgParams = array_values($value['crop']);
$value = array_keys($value['id']);
$rawValues = $value;
}
for ($x = 0; $x < count($value); $x++) {
if (is_array($value)) {
if (array_key_exists($x, $value) && $value[$x] !== '') {
if (is_array($value[$x])) {
// From failed validation
foreach ($value[$x]['id'] as $tKey => $parts) {
$o = new stdClass();
$o->id = 'alreadyuploaded_' . $element->id . '_' . $iCounter;
$o->name = array_pop(explode(DIRECTORY_SEPARATOR, $tKey));
$o->path = $tKey;
if ($fileInfo = $this->getStorage()->getFileInfo($o->path)) {
$o->size = $fileInfo['filesize'];
} else {
$o->size = 'unknown';
}
$o->type = strstr($fileInfo['mime_type'], 'image/') ? 'image' : 'file';
$o->url = $this->getStorage()->pathToURL($tKey);
$o->recordid = $rawValues[$x];
$o->params = json_decode($value[$x]['crop'][$tKey]);
$oFiles->{$iCounter} = $o;
$iCounter++;
}
} else {
if (is_object($value[$x])) {
// Single crop image (not sure about the 0 settings in here)
$parts = explode(DIRECTORY_SEPARATOR, $value[$x]->file);
$o = new stdClass();
$o->id = 'alreadyuploaded_' . $element->id . '_0';
$o->name = array_pop($parts);
$o->path = $value[$x]->file;
if ($fileInfo = $this->getStorage()->getFileInfo($o->path)) {
$o->size = $fileInfo['filesize'];
} else {
$o->size = 'unknown';
}
$o->type = strstr($fileInfo['mime_type'], 'image/') ? 'image' : 'file';
$o->url = $this->getStorage()->pathToURL($value[$x]->file);
$o->recordid = 0;
$o->params = json_decode($value[$x]->params);
$oFiles->{$iCounter} = $o;
$iCounter++;
} else {
$parts = explode('/', $value[$x]);
$o = new stdClass();
$o->id = 'alreadyuploaded_' . $element->id . '_' . $rawValues[$x];
$o->name = array_pop($parts);
//.........這裏部分代碼省略.........
示例4: elementJavascript
/**
* return the javascript to create an instance of the class defined in formJavascriptClass
* @return string javascript to create instance. Instance name must be 'el'
*/
function elementJavascript($repeatCounter)
{
$params = $this->getParams();
$id = $this->getHTMLId($repeatCounter);
//if ((int)$params->get('fileupload_crop', 0) == 1) {
//FabrikHelperHTML::script('media/com_fabrik/js/mcl-min.js');
FabrikHelperHTML::mcl();
/* $src = array('media/com_fabrik/js/lib/mcl/CANVAS.js', 'media/com_fabrik/js/lib/mcl/CanvasItem.js',
'media/com_fabrik/js/lib/mcl/Cmorph.js', 'media/com_fabrik/js/lib/mcl/Layer.js',
'media/com_fabrik/js/lib/mcl/LayerHash.js', 'media/com_fabrik/js/lib/mcl/Thread.js',
'media/com_fabrik/js/lib/canvas-extra.js'
);
FabrikHelperHTML::script($src); */
//}
$element = $this->getElement();
$paramsKey = $this->getFullName(false, true, false);
$paramsKey = Fabrikstring::rtrimword($paramsKey, $this->getElement()->name);
$paramsKey .= 'params';
$formData = $this->getForm()->_data;
$imgParams = JArrayHelper::getValue($formData, $paramsKey);
$value = $this->getValue(array(), $repeatCounter);
$value = is_array($value) ? $value : FabrikWorker::JSONtoData($value, true);
$value = $this->checkForSingleCropValue($value);
//repeat_image_repeat_image___params
$rawvalues = count($value) == 0 ? array() : array_fill(0, count($value), 0);
$fdata = $this->getForm()->_data;
$rawkey = $this->getFullName(false, true, false) . '_raw';
$rawvalues = JArrayHelper::getValue($fdata, $rawkey, $rawvalues);
if (!is_array($rawvalues)) {
$rawvalues = explode(GROUPSPLITTER, $rawvalues);
}
if (!is_array($imgParams)) {
$imgParams = explode(GROUPSPLITTER, $imgParams);
}
$oFiles = new stdClass();
$iCounter = 0;
for ($x = 0; $x < count($value); $x++) {
if (is_array($value)) {
if (array_key_exists($x, $value) && $value[$x] !== '') {
if (is_array($value[$x])) {
//from failed validation
foreach ($value[$x]['id'] as $tkey => $parts) {
$o = new stdClass();
$o->id = 'alreadyuploaded_' . $element->id . '_' . $iCounter;
//$rawvalues[$x];
$o->name = array_pop(explode(DS, $tkey));
$o->path = $tkey;
$o->url = $this->getStorage()->pathToURL($tkey);
$o->recordid = $rawvalues[$x];
$o->params = json_decode($value[$x]['crop'][$tkey]);
$oFiles->{$iCounter} = $o;
$iCounter++;
}
} else {
if (is_object($value[$x])) {
//single crop image (not sure about the 0 settings in here)
$parts = explode(DS, $value[$x]->file);
$o = new stdClass();
$o->id = 'alreadyuploaded_' . $element->id . '_0';
$o->name = array_pop($parts);
$o->path = $value[$x]->file;
$o->url = $this->getStorage()->pathToURL($value[$x]->file);
$o->recordid = 0;
$o->params = json_decode($value[$x]->params);
$oFiles->{$iCounter} = $o;
$iCounter++;
} else {
$parts = explode(DS, $value[$x]);
$o = new stdClass();
$o->id = 'alreadyuploaded_' . $element->id . '_' . $rawvalues[$x];
$o->name = array_pop($parts);
$o->path = $value[$x];
$o->url = $this->getStorage()->pathToURL($value[$x]);
$o->recordid = $rawvalues[$x];
$o->params = json_decode(JArrayHelper::getValue($imgParams, $x, '{}'));
$oFiles->{$iCounter} = $o;
$iCounter++;
}
}
}
}
}
$opts = $this->getElementJSOptions($repeatCounter);
$opts->id = $this->_id;
if ($this->isJoin()) {
$opts->isJoin = true;
$opts->joinId = $this->getJoinModel()->getJoin()->id;
}
$opts->elid = $element->id;
$opts->defaultImage = $params->get('default_image');
$opts->folderSelect = $params->get('upload_allow_folderselect', 0);
$opts->dir = JPATH_SITE . DS . $params->get('ul_directory');
$opts->ajax_upload = (bool) $params->get('ajax_upload', false);
$opts->ajax_runtime = $params->get('ajax_runtime', 'html5');
$opts->max_file_size = $params->get('ul_max_file_size');
$opts->ajax_chunk_size = (int) $params->get('ajax_chunk_size', 0);
//.........這裏部分代碼省略.........