Comments (8)
Interesting feature, but will not be in 0.2 which should be released soon.
from white-pages.
Can you give me advice to implement this feature in your code.
In which file can i works ?
the best way or approach ?
And maybe i can propose code...
Regards,
vlepetit
from white-pages.
You new to create a new type and define how it will appear in search form in templates/search_displayer.tpl
There is already a select box for boolean values, you can use the same idea.
from white-pages.
hi,
so i tried that but i had some problems
1 - I had copy already existing function 'get_attribute' and created an adapt to a new smarty function in smarty.inc.php to return an array ->
function get_attributes_entity($params, $smarty) {
$return = "";
$dn = $params["dn"];
$attributes = $params["attributes"];
$ldap_url = $params["ldap_url"];
$ldap_starttls = $params["ldap_starttls"];
$ldap_binddn = $params["ldap_binddn"];
$ldap_bindpw = $params["ldap_bindpw"];
$ldap_user_filter = $params["ldap_user_filter"];
# Connect to LDAP
$ldap_connection = wp_ldap_connect($ldap_url, $ldap_starttls, $ldap_binddn, $ldap_bindpw);
$ldap = $ldap_connection[0];
$result = $ldap_connection[1];
if ($ldap) {
# Search entry
$search = ldap_search($ldap, $dn, $ldap_user_filter, array($attributes));
$errno = ldap_errno($ldap);
if ( $errno ) {
error_log("LDAP - Search error $errno (".ldap_error($ldap).")");
} else {
$entry = ldap_get_entries($ldap, $search);
//$return = $entry[0][$attribute][0];
$return = $entry;
}
}
$template->assign($params['entitys'], $return);
/*return $return;*/
}
2 - i had register this new plugin in index.php ->
# Register plugins
require_once("../lib/smarty.inc.php");
$smarty->registerPlugin("function", "get_attribute", "get_attribute");
$smarty->registerPlugin("function", "convert_ldap_date", "convert_ldap_date");
$smarty->registerPlugin("function", "get_attributes_entity", "get_attributes_entity");
3 - and i tried to called this function and manipulate the retrurned array values in search_displayer.tpl ->
{elseif {$item} eq 'organizationalunit' and $type eq 'entity'}
{get_attributes_entity entitys="entitysValues" dn="ou=structures,dc=univ-psl,dc=fr" attributes="supanncodeentite,ou" ldap_url="{$ldap_params.ldap_url}" ldap_starttls="{$ldap_params.ldap_starttls}" ldap_binddn="{$ldap_params.ldap_binddn}" ldap_bindpw="{$ldap_params.ldap_bindpw}" ldap_user_filter="ou=*"}
<select class="form-control" id="{$item}" name="{$item}" placeholder="{$label}">
{foreach from=$entitysValues key=supanncodeentite item=ou}
{*<option value="{$entity.supanncodeentite[0]}">{$entity.ou}</option>*}
{$supanncodeentite} : {$ou}<br/>
{$entitys|@print_r}
{/foreach}
</select>
{else}....
But at this moment i can not take values inside returned array.
Ans i don't now if my function/plugin return something...
Maybe you can help me ?
Regards,
vlepetit
from white-pages.
You must not assign to template inside the smarty function. You need to call the function in the template.
from white-pages.
Seems a plugin cannot return an array: smarty-php/smarty#228
The only solution I see is to search for values in php code and assign the result to a template var. It is not as clean as calling directly the plugin in smarty template, but this should work. I will give a try.
from white-pages.
Code done in #74
from white-pages.
Doc updated: https://ltb-project.org/documentation/white-pages/0.3/config_attributes
from white-pages.
Related Issues (20)
- back image instead of default image on gallery when some fields are missing HOT 9
- [WP 0.3] modify the sort results HOT 5
- [WP 0.3] Difficulties to display jpegPhoto HOT 2
- [WP 0.3] Problem with vCard export HOT 7
- Bad value displayed when attribute type is a list HOT 7
- Backup files are loaded as config in lang/
- Login Logout pages HOT 1
- WP not connecting to my ldap server HOT 5
- WP incompatible with PHP 8+ (ldap_sort) HOT 5
- Split debug and debug_smarty
- Provide CSS map files for minified version
- RFE: Only display white pages to authenticated LDAP users HOT 4
- Manage "bytes" attributes
- Feature Request : Negations
- Move documentation in sources HOT 1
- how to use without php-gd HOT 5
- Feature request : Is it possible display Org Chart HOT 4
- Configure cache dir and template cache dir HOT 1
- 404 on bootstrap-datepicker.en.min.js HOT 1
- slow performance on ldap with ssl HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from white-pages.