/** * Displays a EasyContactFormsUsers manageMain view record * * @param object $view * the EasyContactFormsUsers manageMain view object * @param object $obj * a db object * @param int $i * record index * @param array $map * request data */ function getUsersManageMainViewRow($view, $obj, $i, $map) { $jsconf = json_decode(stripslashes($map['a'])); $args = $jsconf->ca[0]; $obj->addjsconfig = (object) array(); $obj->addjsconfig->viewTarget = $args->mt . 'Div'; $obj->addjsconfig->t = $args->mt; $obj->addjsconfig->m = 'mtmview'; $obj->addjsconfig->m2 = 'addRow'; $obj->addjsconfig->n = $args->t; $obj->addjsconfig->a = array(); $obj->addjsconfig->a[] = (object) array('fld' => $args->n, 'oid' => $obj->getId()); $obj->addjsconfig->a[] = (object) array('fld' => $args->fld, 'oid' => $args->oid); $obj->addjsconfig->a = json_encode($obj->addjsconfig->a); $obj->addjsconfig = EasyContactFormsUtils::toJs($obj->addjsconfig); $obj->Add = "onclick='ufo.link({$obj->addjsconfig}, {$view->jsconfig})'"; $obj->Description = array(); $obj->Description[] = $obj->get('Name'); $obj->Description[] = $obj->get('Description'); $obj->Description = EasyContactFormsUtils::vImplode(' ', $obj->Description); ?> <tr> <td class='firstcolumn'> <a id='<?php echo $obj->elId('Add', $obj->getId()); ?> ' title='<?php echo EasyContactFormsT::get('Add'); ?> ' href='javascript:;' class='icon_button_add ufo-mtmlink-button' <?php echo $obj->Add; ?> ></a> </td> <td> <?php echo $obj->get('id'); ?> </td> <td> <a id='<?php echo $obj->elId('Description', $obj->getId()); ?> ' class='ufo-id-link' onclick='ufo.redirect({m:"show", oid:"<?php echo $obj->get('id'); ?> ", t:"Users"})' onmouseover='ufo.showInfo({t:"Users", m2:"getUserASList", oid:<?php echo $obj->get('id'); ?> , m:"ajaxsuggest"}, this)'> <?php echo $obj->Description; ?> </a> </td> </tr> <?php }
/** * Displays a EasyContactFormsCustomForms manageMain view record * * @param object $view * the EasyContactFormsCustomForms manageMain view object * @param object $obj * a db object * @param int $i * record index * @param array $map * request data */ function getCustomFormsManageMainViewRow($view, $obj, $i, $map) { $jsconf = json_decode(stripslashes($map['a'])); $args = $jsconf->ca[0]; $obj->addjsconfig = (object) array(); $obj->addjsconfig->viewTarget = $args->mt . 'Div'; $obj->addjsconfig->t = $args->mt; $obj->addjsconfig->m = 'mtmview'; $obj->addjsconfig->m2 = 'addRow'; $obj->addjsconfig->n = $args->t; $obj->addjsconfig->a = array(); $obj->addjsconfig->a[] = (object) array('fld' => $args->n, 'oid' => $obj->getId()); $obj->addjsconfig->a[] = (object) array('fld' => $args->fld, 'oid' => $args->oid); $obj->addjsconfig->a = json_encode($obj->addjsconfig->a); $obj->addjsconfig = EasyContactFormsUtils::toJs($obj->addjsconfig); $obj->id = "onclick='ufo.link({$obj->addjsconfig}, {$view->jsconfig})'"; ?> <tr> <td class='firstcolumn'> <a id='<?php echo $obj->elId('id', $obj->getId()); ?> ' title='<?php echo EasyContactFormsT::get('Add'); ?> ' href='javascript:;' class='icon_button_add ufo-mtmlink-button' <?php echo $obj->id; ?> ></a> </td> <td> <?php echo $obj->get('id'); ?> </td> <td> <a onclick='ufo.redirect({m:"show", oid:"<?php echo $obj->get('id'); ?> ", t:"CustomForms"})'> <?php EasyContactFormsIHTML::echoStr($obj->get('Description')); ?> </a> </td> </tr> <?php }
/** * toJs * * converts a php data item into js object * (c) dr dot slump at cyteknt dot com * * @param arbitrary $var * php variable * @param boolean $recursed * recursive call flag * * @return string * js code */ function toJs($var, $recursed = FALSE) { if (is_null($var) || is_resource($var)) { return 'null'; } $js = ''; if (is_object($var) || EasyContactFormsUtils::isAssocArray($var)) { $props = (array) $var; foreach ($props as $k => $v) { if (is_int($k)) { $k = "idx_{$k}"; } $js .= $k . ':' . EasyContactFormsUtils::toJs($v, TRUE) . ','; } if (count($props)) { $js = substr($js, 0, strlen($js) - 1); } $js = '{' . $js . '}'; if (!$recursed) { $js = "({$js})"; } } elseif (is_array($var)) { foreach ($var as $v) { $js .= EasyContactFormsUtils::toJs($v, TRUE) . ","; } if (count($var)) { $js = substr($js, 0, strlen($js) - 1); } $js = "[{$js}]"; } elseif (is_string($var)) { $dq = chr(34); $var = str_replace(array(chr(34), chr(10), chr(13)), array(chr(92) . $dq, chr(92) . chr(10)), stripslashes($var)); $js = $recursed ? $dq . $var . $dq : "(new String({$dq}{$var}{$dq}))"; } elseif (is_bool($var)) { $var = $var ? 'TRUE' : 'FALSE'; $js = $recursed ? $var : "(new Boolean({$var}))"; } else { $js = $recursed ? $var : "(new Number({$var}))"; } return $js; }
/** * getFileUpload * * An ajax upload object wrapper * * @param int $id * AjaxUpload button id * @param object $object * AjaxUpload configuration object * * @return string * html text */ function getFileUpload($id, $object) { $jsrequest = EasyContactFormsUtils::toJs($object->request); $jsoncomplete = isset($object->oncomplete) ? ', function(file, ext) {' . $object->oncomplete->func . '(' . $object->oncomplete->args . ')}' : ''; $label = isset($object->value) ? EasyContactFormsT::get('Update') : EasyContactFormsT::get('Upload'); ?> <input type = 'hidden' class = 'ufo-eval' value = 'AppMan.AjaxUpload.create("<?php echo $id; ?> ",<?php echo $jsrequest; echo $jsoncomplete; ?> );'> <span class = 'button internalimage ufo-upload' id = '<?php echo $id; ?> '> <span> <a class = 'icon_button_upload'> <?php echo $label; ?> </a> </span> </span> <?php if (isset($object->value)) { ?> <span class = 'button internalimage' onclick = 'ufo.deleteFile("<?php echo $id; ?> ",<?php echo $jsrequest; ?> , this<?php echo $jsoncomplete; ?> );'> <span> <a class = 'icon_button_delete'> <?php echo EasyContactFormsT::get('Delete'); ?> </a> </span> </span> <?php } }
/** * getJSConfig * * Creates js configuration * * @param array $map * Request data * * @return string * js object */ function getJSConfig($map) { $methods = array('view', 'show'); foreach ($methods as $method) { if ($map['m'] == $method) { return '"' . $this->type . '"'; } } $config = (object) array(); $params = array('m', 't', 'oid', 'n', 'viewTarget'); foreach ($params as $param) { if (isset($map[$param])) { $config->{$param} = $map[$param]; } } if (isset($map['specialfilter'])) { $specialfilter = json_decode(stripslashes($map['specialfilter'])); if (isset($specialfilter[0]) && is_object($specialfilter[0])) { $config->a = (object) array(); $config->a->fld = $specialfilter[0]->property; $config->a->oid = $specialfilter[0]->value->values[0]; $config->a = json_encode($config->a); } } if ($map['m'] == 'mtmview' && isset($map['a'])) { $config->a = $map['a']; } return EasyContactFormsUtils::toJs($config); }